Solve Number of Islands
BloombergSoftware Engineer · OnsiteLast updated
This question evaluates understanding of graph and grid traversal concepts, specifically identifying connected components in a binary matrix and familiarity with traversal strategies such as BFS and DFS.
Question
LeetCode 200. Number of Islands – Given a 2D grid of '1's (land) and '0's (water), count the number of islands. Follow-up: implement the solution with BFS and discuss corner-case handling.
leetcode.com/problems/number-of-islands/description/
Solution walkthrough is for members
Get the full walkthrough with reference code and complexity analysis, plus Kitty Coach at 300 messages a day. Hints, the code runner and community answers stay free.