Loading problem…
Given an m x n 2D grid of "1" (land) and "0" (water), return the number of islands.
m x n
"1"
"0"
An island is formed by connecting adjacent land cells horizontally or vertically. Diagonal cells are not connected.
Example 1:
Example 2:
2 hints available with Pro
Hard