Medium · Greedy

Jump Game

Given an array nums where nums[i] is the maximum jump length from index i, start at index 0 and return true if you can reach the last index, or false otherwise.

Examples

Example 1

[2,3,1,1,4] → true

Output: reachable: true

Example 2

[3,2,1,0,4] → false

Output: stuck: false

Rebuild it in the studio

Core interview problems are free with a full runner and lessons; Pro opens the complete library.

More Greedy problems