Learn
Practice
Newsletter
Resources
Mobile
New
F
Toggle theme
0
F
0
Toggle menu
Animations
← 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
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
Islands Found:
1
0
1
2
3
0
1
2
3
V
1
0
0
V
1
0
0
0
0
1
0
0
0
0
1
(1,0)
front / rear
queue
Islands Found:
1
0
1
2
3
0
1
2
3
V
V
0
0
V
1
0
0
0
0
1
0
0
0
0
1
(0,1)
front / rear
queue
Islands Found:
1
0
1
2
3
0
1
2
3
V
V
0
0
V
V
0
0
0
0
1
0
0
0
0
1
(1,1)
front / rear
queue
Islands Found:
1
0
1
2
3
0
1
2
3
V
V
0
0
V
V
0
0
0
0
1
0
0
0
0
1
queue
Islands Found:
1
0
1
2
3
0
1
2
3
V
V
0
0
V
V
0
0
0
0
1
0
0
0
0
1
queue
Islands Found:
2
0
1
2
3
0
1
2
3
V
V
0
0
V
V
0
0
0
0
V
0
0
0
0
1
(2,2)
front / rear
queue
Islands Found:
2
0
1
2
3
0
1
2
3
V
V
0
0
V
V
0
0
0
0
V
0
0
0
0
1
queue
Islands Found:
3
0
1
2
3
0
1
2
3
V
V
0
0
V
V
0
0
0
0
V
0
0
0
0
V
queue
Islands Found:
3
0
1
2
3
0
1
2
3
V
V
0
0
V
V
0
0
0
0
V
0
0
0
0
V
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
algo
master
.
io
Step:
Start: Count islands using BFS