Repository navigation
Expand file tree
/
Copy path_733_FloodFill.java
More file actions
63 lines (51 loc) · 1.79 KB
/
Copy path_733_FloodFill.java
File metadata and controls
63 lines (51 loc) · 1.79 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
package leetcode.ph;
import leetcode.difficulty.Difficulty;
import leetcode.tag.Topic;
import org.junit.Assert;
import org.junit.jupiter.params.ParameterizedTest;
import org.junit.jupiter.params.provider.Arguments;
import org.junit.jupiter.params.provider.MethodSource;
import java.util.stream.Stream;
import static org.junit.jupiter.params.provider.Arguments.arguments;
public class _733_FloodFill {
private final static LeetCode leetCode = new Test1();
/**
* https://leetcode.com/problems/flood-fill/
*
* @see Difficulty#Easy()
* @see Topic#Array()
* @see Topic#DepthFirstSearch()
* @see Topic#BreadthFirtstSearch()
* @see Topic#Matrix()
*/
@ParameterizedTest
@MethodSource("source")
public void test(int[][] image, int sr, int sc, int color, int expected) {
int[][] actual = leetCode.floodFill(image, sr, sc, color);
Assert.assertEquals(expected, actual);
}
public static class Solution implements LeetCode {
@Override
public int[][] floodFill(int[][] image, int sr, int sc, int color) {
return new int[0][];
}
}
interface LeetCode {
int[][] floodFill(int[][] image, int sr, int sc, int color);
}
public static class Test1 implements LeetCode {
public int[][] floodFill(int[][] image, int sr, int sc, int color) {
return null;
}
}
public static Stream<Arguments> source() {
return Stream.of(
arguments(new int[][]{{1, 1, 1}, {1, 1, 0}, {1, 0, 1}}, 1, 1, 2,
new int[][]{{2, 2, 2}, {2, 2, 0}, {2, 0, 1}}
),
arguments(new int[][]{{0, 0, 0}, {0, 0, 0}}, 0, 0, 0,
new int[][]{{0, 0, 0}, {0, 0, 0}}
)
);
}
}