FunctionRacerProblemsRace

Jump Game

MediumGreedyPython, JavaScript, TypeScript, Java, C++

You stand on index 0 of nums. From index i you may jump forward by any distance from 0 up to nums[i].

Return True if you can reach the last index, otherwise False.

Example 1

nums [2,3,1,1,4]
returns true

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

Example 2

nums [3,2,1,0,4]
returns false

Every path gets stuck on the 0 at index 3.

Constraints

Race itor take your time

Write it in your browser, against the clock. The model solution, stepped through line by line, comes after.

More Greedy problems