DFS Approach to Color the Border of a Connected Component
Perform a DFS starting from the cell (grid[row][col]), marking visited cells to avoid revisiting.
For each cell visited, check if it is a border cell. A cell is a border cell if it is on the edge of the grid or if any of its adjacent cells have a different color.
If a cell is a border cell, add it to a list of border cells.
After the DFS is complete, iterate over the list of border cells and change their color to the new color.
Return the modified grid.
BFS Approach to Color the Border of a Connected Component