Your DFS function now returns an integer instead of void. Here's the approach:
Loop through every cell. When you find an unvisited land cell, call DFS on it.
In DFS, if the cell is out of bounds or water, return .
Mark the current cell as visited by setting it to .
Return (current cell) plus the DFS results from all neighbors.
In the main loop, compare each DFS result to your running maximum.
The recursion builds area bottom-up. Leaf cells return . Parent calls sum these up, giving you the total island size.