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

Read every interview problem free. Ten rooms need no account. A token opens a problem in full — Pro never counts.

More Arrays problems