Question
You are given an
m x nbinary matrixgrid. An island is a group of1’s (representing land) connected 4-directionally (horizontal or vertical.) You may assume all four edges of the grid are surrounded by water.The area of an island is the number of cells with a value
1in the island.Return the maximum area of an island in
grid. If there is no island, return0.
Ideas:
- Basically the same as Leetcode - Number of Islands except we need to count the size of the island in our DFS