Number of Islands (LC #200) counts connected land regions in a grid. For each unvisited land cell, run DFS or BFS to mark all connected land as visited, then increment your count. Mark visited by changing '' to '' for extra space, or use a separate visited set. This runs in time and space. Meta asks follow-ups: what if the grid is too large for memory? Use Union-Find with coordinate compression. What about counting distinct island shapes? Serialize the DFS path as a key.
##### ###### ##### ### # # ### # # ###### ## ## ## ## ## ## ## # # # # # ## ##### #### ##### # # # # # # # #### ## # ## ## ## ## # # # # # ## ## # ###### ## ### # ### # ######
$ curl repovive.com/roadmaps/meta-interview-prep/graphs/number-of-islands
░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░█████████████████████████████████████████████████████████████████████████