天天看点

[LeetCode] Number of Islands解题思路实现代码

given a 2d grid map of <code>'1'</code>s (land) and <code>'0'</code>s (water), count the number of islands. an island is surrounded by water and is formed by connecting adjacent lands horizontally or vertically. you may assume all four edges of the grid are all surrounded by water.

example 1:

answer: 1

example 2:

answer: 3