This is one of Google's most commonly asked problems. Meta, Amazon, LinkedIn, Uber, Microsoft, and Apple all ask it too. It tests connected component counting, which is basic graph theory. The skill transfers to social network analysis, image processing, and many real-world problems. Common follow-ups at Amazon: "What if islands can extend K units into water?" or "Count distinct island shapes." These test whether you can adapt the basic algorithm.
##### ###### ##### ### # # ### # # ###### ## ## ## ## ## ## ## # # # # # ## ##### #### ##### # # # # # # # #### ## # ## ## ## ## # # # # # ## ## # ###### ## ### # ### # ######
$ curl repovive.com/roadmaps/maang-interview-prep/graphs/number-of-islands-why-this-problem
░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░███████████████████████████████████████████████████████████████████████████████████████████