← Back to problems Solve on LeetCode →

Jump Game II

LeetCode 45 • Medium • Greedy

Given nums, start at index 0. Return the minimum number of jumps to reach the last index. Greedy: each time you exhaust the current "jump range" (end), increment jumps and extend end to farthest.

TimeO(n)one pass
SpaceO(1)counters
Step0/0
Index Current i Current jump window end Farthest reach
Ready
Press Play or Step. Loop i only to len(nums)-2 — once you can reach the last index, you are done.