Jump Game

00:00
MediumArrayGreedyDynamic Programming
AmazonMicrosoft

Given array where nums[i] is max jump from index i, determine if you can reach the last index starting from index 0.

Examples

Input → [2,3,1,1,4]
Output → True
Explanation:

0→1→4

Input → [3,2,1,0,4]
Output → False
Explanation:

stuck at index 3

Input → [0]
Output → True
Explanation:

already at end