Jump Game

Medium Solved

Description

You are given an integer array nums. Each element represents your maximum jump length at that position.

Starting at the first index, determine if you can reach the last index.

Input format / Clarification:

  • Line 1: JSON array of non-negative integers (nums)

Examples

Input:

[2,3,1,1,4]

Output: true

Input:

[3,2,1,0,4]

Output: false

Input:

[0]

Output: true

Note:

Your program must print only true or false so it can be compared with the expected output.

No submissions yet.

Discuss greedy vs DP approaches, edge cases, and time complexity.

Test Cases