Data Structures & Algorithms using JavaScript
/Expert
Jump Game
Definition
Given an array of maximum jump lengths, determine if you can reach the last index. The greedy approach tracks the `farthest` index reachable. If at any point `i > farthest`, you are stuck.
Explain Like I'm New
At every stepping stone, look to see how far you could possibly jump. If you reach a stone where your maximum jump distance is 0, you lose.
Interactive Coding Challenges
Jump Game
Solution Code
Loading...
Console output will appear here...
O(N) Time, O(1) Space.