← Back to problems Solve on LeetCode →

Jump Game

LeetCode 55 • Medium • Greedy

Given nums, you start at index 0. Each element is your max jump length. Return whether you can reach the last index. Greedy: track the farthest index reachable; if you pass it, fail.

TimeO(n)one pass
SpaceO(1)farthest
Step0/6
Index Current i Farthest reach
Ready
Press Play or Step. Maintain reach = farthest index you can stand on. If i > reach, you cannot continue.