Quant Memo
Coding/●●●●●

Area of the largest island

Given a binary grid where 1 is land and 0 is water, find the largest island by area (number of cells). Land is connected horizontally or vertically, not diagonally.

grid = [[1, 1, 0, 0],
        [1, 0, 0, 1],
        [0, 0, 1, 1],
        [0, 0, 1, 0]]
-> 4

Return the size in cells of the largest island (0 if there is no land). Aim for O(nm)O(nm).

Your answer

This one is open-ended. Work it through, then check your reasoning against the full solution.

More Coding questions