← Back to all patterns

Number of Islands

BFS/DFS + Visited Marking Pattern · Interactive Visualizer & Interview Guide

Use the controls to step through the BFS traversal, or click Run all to watch it animate.
Land '1'
Water '0'
Current (BFS front)
Visited
Island found
BFS Queue:
0 islands found