MCPcopy Index your code
hub / github.com/careercup/ctci / PaintFill

Method PaintFill

java/Chapter 9/Question9_7/Question.java:38–50  ·  view source on GitHub ↗
(Color[][] screen, int x, int y, Color ocolor, Color ncolor)

Source from the content-addressed store, hash-verified

36 }
37
38 public static boolean PaintFill(Color[][] screen, int x, int y, Color ocolor, Color ncolor) {
39 if (x < 0 || x >= screen[0].length || y < 0 || y >= screen.length) {
40 return false;
41 }
42 if (screen[y][x] == ocolor) {
43 screen[y][x] = ncolor;
44 PaintFill(screen, x - 1, y, ocolor, ncolor); // left
45 PaintFill(screen, x + 1, y, ocolor, ncolor); // right
46 PaintFill(screen, x, y - 1, ocolor, ncolor); // top
47 PaintFill(screen, x, y + 1, ocolor, ncolor); // bottom
48 }
49 return true;
50 }
51
52 public static boolean PaintFill(Color[][] screen, int x, int y, Color ncolor) {
53 if (screen[y][x] == ncolor) return false;

Callers 1

mainMethod · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected