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.