LeetCode 45 Jump Game II - Why Naive Fails

The trap

Try all paths with BFS or recursion. Count minimum jumps.

Exponential paths in worst case. Even with memoization, it's O(n2)O(n^2) without further optimization.

Can you be greedy about which positions to jump to?