← 返回 bloomberg 的题目列表Count Number of Islands in 2D Grid Map
类型:online_judge
bloomberg
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 surrounded by water. Implement a function to count the number of islands.
Example
Input
4 5
11000
11000
00100
00011