LeetCode 695 Max Area of Island - Solution

The core idea

DFS from each unvisited land cell. Count cells visited in each DFS (that's the island's area). Track the maximum.

When you visit a cell, mark it (change to 0 or use a visited set) to avoid recounting.

This is similar to Number of Islands, but instead of counting islands, you track the largest area.