You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: LeetcodeProblems/Flood_Fill.js
+17-18Lines changed: 17 additions & 18 deletions
Original file line number
Diff line number
Diff line change
@@ -6,7 +6,9 @@ An image is represented by a 2-D array of integers, each integer representing th
6
6
7
7
Given a coordinate (sr, sc) representing the starting pixel (row and column) of the flood fill, and a pixel value newColor, "flood fill" the image.
8
8
9
-
To perform a "flood fill", consider the starting pixel, plus any pixels connected 4-directionally to the starting pixel of the same color as the starting pixel, plus any pixels connected 4-directionally to those pixels (also with the same color as the starting pixel), and so on. Replace the color of all of the aforementioned pixels with the newColor.
9
+
To perform a "flood fill", consider the starting pixel, plus any pixels connected 4-directionally to the starting pixel of the same color as the starting pixel,
10
+
plus any pixels connected 4-directionally to those pixels (also with the same color as the starting pixel), and so on.
11
+
Replace the color of all of the aforementioned pixels with the newColor.
10
12
11
13
At the end, return the modified image.
12
14
@@ -25,34 +27,31 @@ Note:
25
27
The length of image and image[0] will be in the range [1, 50].
26
28
The given starting pixel will satisfy 0 <= sr < image.length and 0 <= sc < image[0].length.
27
29
The value of each color in image[i][j] and newColor will be an integer in [0, 65535].
Given a binary tree, find the lowest common ancestor (LCA) of two given nodes in the tree.
6
6
7
-
According to the definition of LCA on Wikipedia: “The lowest common ancestor is defined between two nodes p and q as the lowest node in T that has both p and q as descendants (where we allow a node to be a descendant of itself).”
7
+
According to the definition of LCA on Wikipedia:
8
+
“The lowest common ancestor is defined between two nodes p and q as the lowest node in T that has both p and q as descendants
9
+
(where we allow a node to be a descendant of itself).”
8
10
9
11
Given the following binary tree: root = [3,5,1,6,2,0,8,null,null,7,4]
10
12
@@ -32,6 +34,8 @@ All of the nodes' values will be unique.
32
34
p and q are different and both values will exist in the binary tree.
0 commit comments