← 返回 databricks 的题目列表Max Area of Island
类型:online_judge
Given a 2D grid of non-negative integers where 1 represents land and 0 represents water, determine the maximum area of an island (an island is formed by connected 1s).
Input: grid = [[0,1,0],[1,1,1],[0,1,0]]
Output: 5
Note: The 2D grid is surrounded by water on all four sides.
Example
Input
[[0,1,0],[1,1,1],[0,1,0]]