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…