Jump Game
You are given an integer array nums. You are initially positioned at the first index, and each element nums[i] represents your maximum jump length from index i.
Return true if you can reach the last index, or false otherwise.
Example 1
Input
nums = [2,3,1,1,4]Output
trueStarting at index 0, jump 1 step to index 1, then jump 3 steps to reach the last index.
Example 2
Input
nums = [3,2,1,0,4]Output
falseNo matter how you jump, you will arrive at index 3 where
nums[3] is 0 and cannot move past it to the last index.Constraints
- 1 <= nums.length <= 10^4
- 0 <= nums[i] <= 10^5