You are given an grid, and three integers row, col, and color. Each value in grid represents the color of the square at that coordinate.
Two squares belong to the same connected component if they share the same color and are adjacent to each other in one of the four cardinal directions.
The border of a connected component is defined as all squares in that component that are situated on the boundary of the grid or are adjacent to at least one square that does not belong to the component.
Return the modified grid.
Constraints:
m == grid.length
n == grid[i].length
m, n
grid[i][j], color
row
col
You are given an grid, and three integers row, col, and color. Each value in grid represents the color of the square at that coordinate.
Two squares belong to the same connected component if they share the same color and are adjacent to each other in one of the four cardinal directions.
The border of a connected component is defined as all squares in that component that are situated on the boundary of the grid or are adjacent to at least one square that does not belong to the component.
Return the modified grid.
Constraints:
m == grid.length
n == grid[i].length
m, n
grid[i][j], color
row
col