Graph BFS / DFS · Medium
Number of Islands
O(M * N) · O(M * N)
Step 1: Setup & Initialization - Number of Islands
Flood-fill DFS/BFS to sink land cells.
Array Elements & Pointers
10
[0]20
[1]30
[2]40
[3]50
[4]Live Variables & Invariants
status:Initialized
pattern:Number of Islands
Step 1 / 3
33%
Solution Code
LeetCode IDE Console
Test Cases
4 cases from Blind 75 & NeetCode 150
Ask for a hint whenever you get stuck.