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
Note: 0→1→4
Input → [3,2,1,0,4]
Output → False
Note: stuck at index 3
Input → [0]
Output → True
Note: already at end