← 返回 uber 的题目列表Number of Islands
类型:online_judge
Given a 2D grid consisting 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. The grid size is m x n. Each position can be accessed in O(1) time.
Example
Input
11110
11010
11000
00000