IntermediateRating 1300
Can You Reach the End?
a[i] is the maximum jump length from position i. Starting at index 0, print YES if you can reach the last index.
Input
n, then n non-negative integers.
Output
YES or NO.
Sample 1
Input
5 2 3 1 1 4
Output
YES
Sample 2
Input
5 3 2 1 0 4
Output
NO
Output appears here