# Max Area of Island

Given a non-empty 2D array `grid` of 0's and 1's, an **island** is a group of `1`'s (representing land) connected 4-directionally (horizontal or vertical.) You may assume all four edges of the grid are surrounded by water.

Find the maximum area of an island in the given 2D array. (If there is no island, the maximum area is 0.)\
주어진 2D 배열에서 **최대 면적인** 섬의 크기를 구해라.//**문제를 정확하게 이해하는 것이 가장 중요하다!**

![](https://3269900549-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-MIbwNq54Ge4eqsziHM7%2F-MPlSwR9L28ar0Sgpz7D%2F-MPlTDynxB8xbIgCxM_D%2FScreen%20Shot%202020-12-30%20at%2011.27.20%20AM.png?alt=media\&token=757a3a88-6cdd-4c01-9f9d-fa5061f8062f)

**알고리즘**\
1.DFS/BFS든 4방으로 서치한다.\
4번의 재귀호출보다는, **4방으로 돌릴 때 상/하/좌/우 를 의미하는 좌표값 배열을 만들어서 돌린다.**\
2.DFS에 면적값을 다루는 매개변수를 하나 더 넣는다.
