Jump Game
Starting at index zero, nums[i] is your maximum forward jump length from i. Return whether you can reach the final index.
Example 1
nums = [2,3,1,1,4]trueExplanation
Jump from 0 to 1, then use reach 3 to land at final index 4.
Example 2
nums = [3,2,1,0,4]falseExplanation
No reachable index can jump beyond the zero at index 3.
Example 3
nums = [0]trueExplanation
The sole starting index is already the finish.
Constraints
- 1 <= len(nums) <= 10000
- Values are 0..100000
Function contract
canJumpArguments: jsonSolutionRuns on your device
Loading draft…
Run: 3 examples; Submit: 34 cases, on your device.
[2,3,1,1,4]