Number of Islands · Compound Engineer

Number of Islands

Count the groups of connected land in a grid. Why the first land cell you meet starts a new island, and how a BFS flood fill that sinks cells as it queues them counts each island exactly once.

DSAFreeMediumStep-through playerBy Aayush OstwalSolve on LeetCode ↗
Spotted a mistake in this lesson?Report an issue →