给定一个2维数字表格,其中'1'代表岛,'0'代表水,要求计算岛的数量。一个岛被水包围着,其上下左右的格子是1的话也算同一个岛。你可以假设表格的四个边外都是水。
Given a 2d grid map of '1'
s (land) and '0'
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.
例子1:
1111