LeetCode 55 Jump Game - Problem Statement

The problem

Given an array where nums[i] is the maximum jump length from position i, determine if you can reach the last index starting from the first index.

With nums = [2,3,1,1,4]:

  • From 0, jump to 1 or 2.
  • From 1, jump up to 3 positions, reaching the end.
  • Return true.

With nums = [3,2,1,0,4]:

  • From 0, can reach at most position 3.
  • Position 3 has value 0. Stuck!
  • Can't reach position 4.
  • Return false.

Constraints: 11 \le nums.length 104\le 10^4.