Medium · Arrays

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

Open every published interview problem, solution, scene, and memory room free, with no account.

More Arrays problems