23 / 75
Determine if you can reach last index by tracking furthest reachable position greedily.
Example:
Input:
[2,3,1,1,4]Output:
true (jump 1 step from 0 to 1, then 3 steps to last)Common Mistakes:
- Using DP when greedy O(n) solution exists
- Not checking if current index is reachable before updating
- Overthinking - just track maximum reachable position
Notes:
Greedy approach is optimal. Time O(n), Space O(1). DP would be O(n²) and unnecessary.
💻
Java Solution Hidden
Enable “Show Full Solution” to view the code
Determine if you can reach last index by tracking furthest reachable position greedily.
Example:
Input:
[2,3,1,1,4]Output:
true (jump 1 step from 0 to 1, then 3 steps to last)Common Mistakes:
- Using DP when greedy O(n) solution exists
- Not checking if current index is reachable before updating
- Overthinking - just track maximum reachable position
Notes:
Greedy approach is optimal. Time O(n), Space O(1). DP would be O(n²) and unnecessary.
23/75
Jump Game