#55

Jump Game

Medium Furthest reach

  1. Read
  2. Understand
  3. Hints
  4. Approach
  5. Solution
  6. Solved

?The problem

nums[i] is the maximum jump length from index i. Starting at index 0, decide whether you can reach the last index.

This is a short summary in our own words. Read the full statement and examples on LeetCode: open problem ↗

◎Understanding

Really asking: can you reach the last index?

Why this works: track the furthest index reachable. If you ever stand beyond it, you're stuck.

Example: [3, 2, 1, 0, 4]

reach 3, 3, 3, 3index 4 > reach 3 → false

✦Hints open one at a time

↗Approach

</>Solution (Java)

!Common mistake

Trying all jumps recursively — exponential without memoisation.

Solve on LeetCode ↗
Complexity
  • Time: O(n).
  • Space: O(1).
Topic: Greedy
🎬 Episodes 69–73: video coming soon