Objective
Each number is the maximum jump that can be made from that position. A greedy strategy keeps the farthest reachable position at every moment and checks whether the end is reached.
Instructions
- Read a line of non-negative integers; you start at the first position.
- Show
Reachableif the last position can be reached orNot reachableif not.
2 3 1 1 4
Reachable
Open the editor in full screen: the statement on the left and your code, the output and the tests on the right.
Start exercise