Given an image (2D grid of integer colors), a starting pixel (sr, sc), and a new color, perform a flood fill: change the starting pixel and all pixels connected to it (4-directionally) that share its original color to the new color. Return the resulting image. The input is JSON {image, sr, sc, color}.
Input: JSON {image, sr, sc, color}.
Output: Nested array — the filled image.
Input: {"image":[[1,1,1],[1,1,0],[1,0,1]],"sr":1,"sc":1,"color":2}
Output: [[2,2,2],[2,2,0],[2,0,1]]
Explanation: Connected 1s become 2.Input: {"image":[[0,0,0],[0,0,0]],"sr":0,"sc":0,"color":2}
Output: [[2,2,2],[2,2,2]]
Explanation: Whole region filled.Input: {"image":[[5]],"sr":0,"sc":0,"color":5}
Output: [[5]]
Explanation: Same color, no change.1<=rows,cols<=100