Browse Curriculum
FAANGPrep Sprint
Medium
Jump Game
Determine if you can reach the last index.
10 min read
Solve on LeetCodeProblem Understanding
You are given an array nums. nums[i] is the maximum jump length from that position. Return true if you can reach the last index.
Strategy
We can track the maximum reachable index.
- Init
reachable = 0. - Iterate
ifrom 0 tonums.length - 1. - If
i > reachable, we are stuck! Returnfalse. - Update
reachable = max(reachable, i + nums[i]). - If
reachable >= last_index, returntrue.
Interactive Visualization
Step 1 / 1
Initializing...
1x
Track the 'Max Reachable' index. As long as i <= reachable, we can proceed.
ON THIS PAGE
- Problem Understanding
- Strategy
- Interactive Visualization
Stop Guessing, Start Mastering.
Build the FAANG intuition. Master this pattern with optimized implementations, visual dry runs, and our curated collection of high-yield problems.
