Learn
Practice
Newsletter
Resources
F
Toggle theme
0
F
Toggle theme
0
Toggle menu
← Back to All Animations
Number of Islands
Bookmark
Input
Example 1
5 islands
Single Island
All Water
Custom
grid
=
[["1","1","0","0"],["1","1","0","0"],["0","0","1","0"],["0","0","0","1"]]
Islands Found:
0
0
1
2
3
0
1
2
3
1
1
0
0
1
1
0
0
0
0
1
0
0
0
0
1
queue
algo
master
.
io
Step:
Start: Count islands using BFS
0 / 63
Input
Example 1
5 islands
Single Island
All Water
Custom
grid
=
[["1","1","0","0"],["1","1","0","0"],["0","0","1","0"],["0","0","0","1"]]
0 / 63
Islands Found:
0
0
1
2
3
0
1
2
3
1
1
0
0
1
1
0
0
0
0
1
0
0
0
0
1
queue
algo
master
.
io
Step:
Start: Count islands using BFS