Jump Game

Medium · Greedy · Array · Greedy · Dynamic Programming

Problem

You start at index 0. nums[i] is the furthest you may jump forward from index i. Return whether you can reach the last index.

Examples

Input: nums = [2,3,1,1,4]
Output: True

Jump 1 to index 1, then 3 to the end.

Input: nums = [3,2,1,0,4]
Output: False

Every route lands on the 0 at index 3 and stops.

Constraints

Approaches

Related problems

Start free on Cariara · Coding problems · System design studio

Starting Python
No results yet.

          
↑↓ move ↵ open esc close

Labs

Loading labs…

Run with your own input

Starting Python

Loading Python…