End of Array Reachable

Languages

Given an array of integers numbers, starting at the first index of the array, each element in the array represents the maximum number of steps that can be jumped forward from that position.

Determine whether it is possible to arrive at the final index of the array, returning true if it can be achieved and false otherwise.

Input

  • numbers: number[]: An array of integers

Examples

Input: numbers = [4,1,0,0,2,3]
Output: true
Explanation: Jump from index 0 to 4 directly, then jump 1 step to the last index.
Input: numbers = [1,0,0,0]
Output: false
Explanation: Can only jump to index 1 from index 0. Maximum jump length of index 1 is 0, making it impossible to reach the last index.
Input: numbers = [2,3,1,1,4]
Output: true
Explanation: Jump 1 step from index 0 to 1 and then 3 steps to the last index.

Constraints

  • 1 <= numbers.length <= 10,000
  • 0 <= numbers[i] <= 100,000