← Greedy

Pattern Recognition Drill

#72 — Jump game

Medium Greedy

The Problem

Can you reach the last index? Each element is the max jump length from that position.

What approach would you use?

Think about it before scrolling down.

Key Signals

Greedy

Track max_reach. At each position i: if i > max_reach, return False. Else update max_reach. O(n).

Alt: Dynamic Programming

dp[i] = can reach i? Works but O(n²). Greedy is O(n) because reachability is monotonic.

Common Trap

DP is correct but slow. The greedy insight: once a position is reachable, all earlier ones are too.

← #71 #73 →