Problem
An image is a grid of integers, one per pixel. Starting from the pixel at row sr, column sc, repaint it with color, then keep spreading to every pixel that shares the starting pixel's original colour and touches an already repainted pixel up, down, left or right. Return the image after the fill.
Example 1
image = [[1, 1, 1],
Example 2
[1, 1, 0],
Example 3
[1, 0, 1]], sr = 1, sc = 1, color = 2
Example 4
→ [[2, 2, 2],
Example 5
[2, 2, 0],
Example 6
[2, 0, 1]] (the bottom-right 1 only touches the region diagonally)
Example 7
image = [[0, 0, 0],
Example 8
[0, 0, 0]], sr = 0, sc = 0, color = 0
Example 9
→ unchanged (the new colour is the old colour)
Constraints
1 <= image.length, image[i].length <= 500 <= image[i][j], color < 2^160 <= sr < image.length and 0 <= sc < image[0].length