Jump Game
Medium
LC #55
greedyarrayNot attempted yet
You start at index 0 of nums. From index i you may
jump forward up to nums[i] steps.
Return True if you can reach the last index, otherwise
False.
Example 1
Input: nums = [2,3,1,1,4]
Output: True
Jump 1 step to index 1, then 3 steps to the end.
Example 2
Input: nums = [3,2,1,0,4]
Output: False
Every path lands on index 3, whose jump length is 0.
Example 3
Input: nums = [0]
Output: True
You already stand on the last index.
Constraints
- 1 <= nums.length <= 10^5
- 0 <= nums[i] <= 10^5