Leetcode 827. Making A Large Island
- Type: Search dfs
- Approach:
- Explore every island using DFS, count its area, give it an island index and save the result to a {index: area} map.
- Loop every cell == 0, check its connected islands and calculate total islands area.
- Complexity:
- Time: O(n^2)
- Space: O(n^2)