Loading...
Loading...
Loading...
You stand on the first cell of a row. Cell i holds the longest jump you may make from it, and you may jump any shorter distance as well. Print YES if you can reach the last cell, otherwise NO.
Example 1
Input
2 3 1 1 4
Output
YES
Example 2
Input
3 2 1 0 4
Output
NO
Try the problem first. Open one hint at a time.
Keep the farthest index you can reach so far.
If the current index is beyond that reach, you are stuck.
Write your Python code, run it on the examples and submit it to hidden tests.
Solve in the editor