Compute area of each island via flood-fill and take the maximum.
For each land cell, DFS to count connected land, marking visited cells as water. Track the maximum area.
Each island’s cells are visited once in a single DFS, producing its exact area.
Compute area of each island via flood-fill and take the maximum.
For each land cell, DFS to count connected land, marking visited cells as water. Track the maximum area.
Each island’s cells are visited once in a single DFS, producing its exact area.