Number of Islands
Asked at Apple · Coding Questions · Difficulty: Medium · Last asked Mar 31, 2026
Given a 2D grid `grid` where `'1'` represents land and `'0'` represents water, count and return the number of islands.
Loading the problem…
More Apple interview questions
- LLM conceptual questions
- Implement a Two-Hidden-Layer MLP with Backpropagation in NumPy
- Compare PPO, DPO, and GRPO
- Implement a Vision Transformer (ViT) from Scratch
- Sample from a Gaussian Distribution Using Only Uniform Sampling
- Diagnose a CTR Drop After a Ranking Model Launch