Number of Islands
Last updated
What is Number of Islands?
Given a 2D grid of land and water cells, count the number of islands. You do DFS from each unvisited land cell, marking the entire connected landmass as visited before moving on. This is the entry point for graph DFS on a matrix and teaches you to treat a grid as an implicit graph where adjacency is defined by up, down, left, right neighbors.
Free resources to learn Number of Islands
More in stage 14: Graphs
Number of Islands: common questions
Can I learn Number of Islands in Hindi?
This lesson is written in English. Once you sign in, open it in the interactive course and ask the AI tutor to explain Number of Islands in Hindi or Hinglish. The tutor answers from this lesson’s own text, so it stays on the syllabus, and it runs on your own Google, OpenAI or Anthropic key.
Is this Number of Islands tutorial for beginners?
It is lesson 83 of 137 in the free LeetCode roadmap, in stage 14, Graphs. If you are new to LeetCode, start from stage 1 and come back here in order; if you already know the earlier stages, this lesson stands on its own.