LeetCode: https://leetcode.com/problems/number-of-islands/
Given an m x n 2D binary grid grid which represents a map of '1's (land) and '0's (water), return the number of islands.
Example:
- Input:
grid = [["1","1","0"],["1","0","0"],["0","0","1"]] - Output:
2
1
1
0
1
0
0
0
0
1
r=0
c=0
islands=1
Step 1 / 4
Step 1:
During the scan, the first unvisited land cell starts a new island; DFS “sinks” all connected land.
Focus: select @ [0]
r=0c=0islands=1