Find the Number of Islands

Prereq: BFS on Graph

Given a 2-dimensional matrix of values with 0 and 1, count the number of islands of 1. An island consists of all 1 value cells and is surrounded by either an edge or all 0 cells. Cells can only be adjacent to each other horizontally or vertically, not diagonally.

Invest in Yourself
Your new job is waiting. 83% of people that complete the program get a job offer. Unlock unlimited access to all content and features.
Go Pro