Learn
Practice
Interview
Resources
Newsletter
F
Toggle theme
0
F
0
Toggle menu
Animations
← Back to All Animations
Making A Large Island
Bookmark
Brute Force
Island Labeling
Union-Find
Input
2x2 Diagonal
Two Islands
Three Islands
All Land
All Water
Custom
grid
=
[[1,0],[0,1]]
1
0
0
1
1
0
0
1
phase:
answer
1
0
0
1
nothing to do here, skip
phase:
answer
1
1
0
1
phase:
answer
1
1
0
1
phase:
answer
1
3
0
1
new best:
3
phase:
answer
1
3
0
1
flip it back to water and move on
phase:
answer
1
3
1
1
phase:
answer
1
3
1
1
phase:
answer
1
3
0
1
flip it back to water and move on
phase:
answer
1
3
0
1
return 3
algo
master
.
io
Step:
Making a Large Island: flip one 0 to 1 to build the biggest possible island
0 / 17
Input
2x2 Diagonal
Two Islands
Three Islands
All Land
All Water
Custom
grid
=
[[1,0],[0,1]]
0 / 17
algo
master
.
io
Step:
Making a Large Island: flip one 0 to 1 to build the biggest possible island