Island Statistics
Snapchat interview questions · Medium · Coding round · 6 tests
The input is a binary grid of size m x n. A cell holding 1 is land
and a cell holding 0 is water. Land cells that touch through a shared side (up, down,
left or right) belong to the same island, and each island is as large as that connectivity
allows.
In this practice variant, every island needs two measurements:
- Area: how many land cells make up the island.
- Perimeter: how many cell sides of the island face water or the edge of the grid.
Run your code with Ctrl+Enter to see results.