TRACK B · ALGORITHMmedium•NOVEMBER 2026•5 MIN
Greedy Running Frontier: Reachability in O(1) Space
Replace O(n²) DP with a single running frontier when local progress never hurts future options.
greedyarraysfrontieroptimization
The core idea
In Jump Game / checkpoint reachability, the set of reachable indices is always a contiguous prefix [0..farthest]. Tracking that single number solves reachability in one linear pass.
Watch it run
Step through the trace below (or turn on Predict Mode) to watch the invariant hold at every step.
LOADING GREEDY REACH SIM...
What to say out loud
Canonical Python template
def can_reach_end(hops: list[int]) -> bool:
farthest = 0
for i, step in enumerate(hops):
if i > farthest:
return False
farthest = max(farthest, i + step)
return True