Skip to content

Latest commit

 

History

History
8 lines (8 loc) · 379 Bytes

File metadata and controls

8 lines (8 loc) · 379 Bytes
  • Type: Search dfs
  • Approach:
    1. Explore every island using DFS, count its area, give it an island index and save the result to a {index: area} map.
    2. Loop every cell == 0, check its connected islands and calculate total islands area.
  • Complexity:
    • Time: O(n^2)
    • Space: O(n^2)