616. Jump Game
0
Medium
Given an array of integers called nums, you start at the first index of the array. Each element in the array represents the maximum number of steps you can take from that position. Determine if it is possible to reach the last index of the array.
Input Format
The first line of input contains the size of the array.
The second line of input contains the elements of the array.
Output Format
Print True if it is possible to reach the last index, and False otherwise.
Example
Input
5
2 3 1 1 4
Output
True
Constraints
1 <= nums.length <= 10^4
0 <= nums[i] <= 10^5
Loading...
View Submissions
Console