757. Flood Fill On Image
Given an integer grid image of size m x n, where each element image[i][j] represents the pixel value of the image, perform a flood fill on the image starting from the pixel image[sr][sc]. A flood fill involves changing the color of the starting pixel and all connected pixels of the same color, including those connected diagonally. Replace the color of all these pixels with the newColor. Print the modified image after performing the flood fill.
The first line of input will contain two integers n and m. The next n lines will each contain m space-separated integers representing the elements of the image grid. The third line will contain three integers sr, sc, and newColor, representing the starting pixel position and the new color to be used.
Print the modified image after performing the flood fill.
3 3 1 1 1 1 1 0 1 0 1 1 1 2
2 2 2 2 2 0 2 0 1
N and M are both less than or equal to 50