Reported interview periodDec 2025–Aug 2026
Islands in a Dynamic Grid
You are given a rectangular binary grid. 1 represents land and 0 represents water. Cells belong to the same island when they share an edge; diagonal contact does not connect islands.
Practice focusFirst implement: Then support a grid that begins as all water. After each (row, column) operation, turn that cell into land and report the current island count: Adding an already-land cell leaves the count unchanged. Assume coordinates are in bounds. Staged follow-ups 1. Compare DFS, BFS, and disjoint-set solutions for the static problem. 2. Achieve near-constant amortized work per addition with union by rank and path compression. 3. Discuss the harder case in which land can also be removed.