Question bank › Graphs Dfs
Dsa Graphs Dfs Easy

Island Size Count

You are given a 2D grid representing a map of land and water. 1s represent land and 0s represent water. Your task is to count the size of each island and return the sizes in a sorted order. An island is surrounded by water and is formed by connecting adjacent lands horizontally or vertically. The input format is: 3 1 1 0 1 0 0 0 0 1 In this case, the first island has size 3 and the second island has size 1. You should output: [1, 3] indicating the size of islands in ascending order.

Key concepts

graphsdfsisland counting

Practise this out loud — free

Start a mock interview on THIS exact question — a voice AI interviewer opens with it, pushes back like a real onsite, then hands you an instant scorecard.

🎙 Practise this question now
Part of InterviewLab's verified interview question bank. We show the prompt and concepts to practise with — never a copy-paste solution.