Skip to content
DSA Visualizerpreview

Jump game (farthest reach)

Walk forward, keeping only the farthest square you could reach; if you ever pass it, you are stuck.

O(n) time · O(1) space

Jump lengths2, 3, 1, 1, 0, 4

Each number is the longest jump from that square. Can we get from square 0 to square 5?

Jump lengths 2, 3, 1, 1, 0, 4; farthest reachable index so far 0.
  • compare
  • swap or write
  • settled

1 / 7

Speed

Space play · ← → step · Home End jump · drag the strip to scrub