Solving Number of Islands
To see the question, click here. Naive Approach 1 The idea is to use the DFS algorithm to explore the grid. Whenever it encounters a land cell ('1') that has not been visited, it marks it as visited and recursively explores all its adjacent (up, down...
Jul 2, 20248 min read2