Given an array of non-negative integers, you are initially positioned at the first index of the array.
Each element in the array represents your maximum jump length at that position.
Determine if you are able to reach the last index.
For example:
A = [2,3,1,1,4], return true.
A = [3,2,1,0,4], return false.
算法一
思路:从后往前推,
为了跳到结尾,
每往前倒推一步,累加步数,并看看当前位置的值是否大于该步数。
如果该值大于需求步数,则表示从该位置可以跳到结尾。
则此位置可以视作新的结尾......
阅读全文