```
class Solution:
def maxAreaOfIsland(self, grid):
return max([self.dfs(r, c, grid) for r in range(len(grid)) for c in range(len(grid[0]))])
def dfs(self, r, c, grid):
if not (0 <= r < len(grid) and (0 <= c < len(grid[0])) and grid[r][c]):
return 0
grid[r][c] = 0
return 1 + sum([self.dfs(r + x[0], c + x[1], grid) for x in [(0, 1), (0, -1), (1, 0), (-1, 0)]])
```