Learn
Practice
Interview
Resources
Newsletter
F
Toggle theme
0
F
0
Toggle menu
Animations
← Back to All Animations
Jump Game
Bookmark
DP
Forward Reach
Backward Goal
Input
Can reach (true)
Can't reach (false)
Single element
Just enough
All ones
Large first jump
Custom
nums
=
[2, 3, 1, 1, 4]
0
1
2
3
4
goal
2
3
1
1
4
0
1
2
3
4
goal
2
3
1
1
4
maxReach =
0
goal =
4
0
1
2
3
4
goal
2
3
1
1
4
dp
T
F
F
F
F
i
maxReach =
0
goal =
4
0
1
2
3
4
goal
2
3
1
1
4
dp
T
F
F
F
F
j
i
maxReach =
0
goal =
4
0
1
2
3
4
goal
2
3
1
1
4
dp
T
T
F
F
F
i
maxReach =
0
goal =
4
0
1
2
3
4
goal
2
3
1
1
4
dp
T
T
T
F
F
j
i
maxReach =
0
goal =
4
0
1
2
3
4
goal
2
3
1
1
4
dp
T
T
T
F
F
i
maxReach =
0
goal =
4
0
1
2
3
4
goal
2
3
1
1
4
dp
T
T
T
T
F
j
i
maxReach =
0
goal =
4
0
1
2
3
4
goal
2
3
1
1
4
dp
T
T
T
T
F
j
i
maxReach =
0
goal =
4
0
1
2
3
4
goal
2
3
1
1
4
dp
T
T
T
T
T
j
i
maxReach =
0
goal =
4
0
1
2
3
4
2
3
1
1
4
dp
T
T
T
T
T
Can reach the last index →
true
algo
master
.
io
Step:
Start: mark every index that some earlier reachable index can jump to.
0 / 15
Input
Can reach (true)
Can't reach (false)
Single element
Just enough
All ones
Large first jump
Custom
nums
=
[2, 3, 1, 1, 4]
0 / 15
algo
master
.
io
Step:
Start: mark every index that some earlier reachable index can jump to.