Learn
Practice
Interview
Resources
Newsletter
F
Toggle theme
0
F
0
Toggle menu
Animations
← Back to All Animations
Number of Distinct Islands
Bookmark
Normalization
Path Signature
Input
2 Same Shapes
3 Distinct
4 Same (Single)
Distinct Shapes
Custom
grid
=
[[1,1,0,0,0],[1,0,0,0,0],[0,0,0,1,1],[0,0,0,0,1]]
Distinct Islands:
0
0
1
2
3
4
0
1
2
3
1
1
0
0
0
1
0
0
0
0
0
0
0
1
1
0
0
0
0
1
cells
shapes
Distinct Islands:
0
0
1
2
3
4
0
1
2
3
1
1
0
0
0
1
0
0
0
0
0
0
0
1
1
0
0
0
0
1
cells
shapes
Distinct Islands:
0
0
1
2
3
4
0
1
2
3
1
1
0
0
0
1
0
0
0
0
0
0
0
1
1
0
0
0
0
1
cells
(0,0) (1,0)
shapes
Distinct Islands:
0
0
1
2
3
4
0
1
2
3
1
1
0
0
0
1
0
0
0
0
0
0
0
1
1
0
0
0
0
1
cells
(0,0) (1,0)
shapes
Distinct Islands:
0
0
1
2
3
4
0
1
2
3
1
1
0
0
0
1
0
0
0
0
0
0
0
1
1
0
0
0
0
1
cells
(0,0) (1,0) (0,1)
shapes
Distinct Islands:
1
0
1
2
3
4
0
1
2
3
1
1
0
0
0
1
0
0
0
0
0
0
0
1
1
0
0
0
0
1
cells
shapes
"0,0;0,1;1,0"
Distinct Islands:
1
0
1
2
3
4
0
1
2
3
1
1
0
0
0
1
0
0
0
0
0
0
0
1
1
0
0
0
0
1
cells
[]
shapes
"0,0;0,1;1,0"
Distinct Islands:
1
0
1
2
3
4
0
1
2
3
1
1
0
0
0
1
0
0
0
0
0
0
0
1
1
0
0
0
0
1
cells
(2,3)
shapes
"0,0;0,1;1,0"
Distinct Islands:
1
0
1
2
3
4
0
1
2
3
1
1
0
0
0
1
0
0
0
0
0
0
0
1
1
0
0
0
0
1
cells
(2,3) (2,4) (3,4)
shapes
"0,0;0,1;1,0"
Distinct Islands:
1
0
1
2
3
4
0
1
2
3
1
1
0
0
0
1
0
0
0
0
0
0
0
1
1
0
0
0
0
1
top-left
minR = 2, minC = 3
shapes
"0,0;0,1;1,0"
Distinct Islands:
2
0
1
2
3
4
0
1
2
3
1
1
0
0
0
1
0
0
0
0
0
0
0
1
1
0
0
0
0
1
cells
shapes
"0,0;0,1;1,0"
"0,0;0,1;1,1"
algo
master
.
io
Step:
Start: Count distinct islands by their shifted coordinates
0 / 81
Input
2 Same Shapes
3 Distinct
4 Same (Single)
Distinct Shapes
Custom
grid
=
[[1,1,0,0,0],[1,0,0,0,0],[0,0,0,1,1],[0,0,0,0,1]]
0 / 81
algo
master
.
io
Step:
Start: Count distinct islands by their shifted coordinates