You are given a 2D grid image[][] representing an image, where each cell contains a color value. You are also given a starting cell (sr, sc) and a new color newColor. Your task is to replace the color of the starting cell and all 4-directionally connected cells having the same original color with newColor. Cells are connected only in four directions: Up, Down, Left, Right. Return the updated image after performing the flood fill.
Topics
Companies
Articles
Examples:
N/A
Constraints:
m == image.length
n == image[i].length
1 = m, n = 50
0 = image[i][j], newColor < 216
0 = sr < m
0 = sc < n
Companies:
AmazonMicrosoftAppleSamsungVisa + 1 more
Topics:
Recursion
Please log in to access the Submissions tab, where you can review your progress and explore code submissions from other participants.
Please log in to access the Solution tab and view detailed answers and explanations.
Please log in to access the Discussion tab and join conversations with other participants.
Access Restricted: Please Login to access the code editor and test cases.