Skip to content
playdsa
Preferences

Make yourself comfortable.

Saved on this browser. Your device’s reduced-motion preference is always respected.

Theme
Advanced settings

The Furthest Step

Learn
Play
Prove
Problem context and objectives
Mission briefing

Puzzle systems engineer · A game mechanic is behaving incorrectly

Preserve the best reachable frontier: The Furthest Step.

Brute force may pass the demo but fail when the world fills with players.

How you win

  1. 1Recognize when Greedy reachability matches the clues
  2. 2Keep this true after every move: furthest is the maximum reachable index from the processed prefix
  3. 3Reach the result within O(n)

Rules and pressure

  • Target cost: O(n)
  • State rule: furthest is the maximum reachable index from the processed prefix
Lesson 1 of 3

Live algorithm trace

Greedy reachability

Complete execution
1 of 6

Only index 0 is known reachable before the scan begins.

1furthest = 0
2if i > furthest: return false
3furthest = max(furthest, i + nums[i])
4return true
furthest = 0
Truth to preserve / Cost target
Truth to preserve

furthest is the maximum reachable index from the processed prefix

Cost target

O(n)

A greedy scan keeps the furthest reachable index. Every position at or before that frontier is usable, and each jump may extend the frontier.

Your call · What should guide every step of this algorithm?

Help shape PlayDSA

Something confusing, broken, or missing? Leave a quick note without leaving your lesson.

Please leave out passwords, payment details and other private information.

Page included: /

Sign in to save feedback here, or send it with your email app. Your draft stays here while you sign in.

Open email instead