Jump Game

Try to solve the Jump Game problem.

Statement

Given an array of integers called nums, each element represents a square in a game board. At each turn, the player can take up to ss steps toward the last square, where ss is the value of the current square. This means from any position, you can move forward by any number of steps from 11 up to the value at that position. Starting at the first index, your goal is to determine whether it’s possible to reach the last index of the array. Write a function that returns TRUE if you can reach the end, or FALSE if you get stuck somewhere.

Constraints:

  • 11 \leq nums.length 103\leq 10^3
  • 00 \leq nums[i] 103\leq 10^3

Create a free account to view this lesson.

Continue your learning journey with a 14-day free trial.

By signing up, you agree to Educative's Terms of Service and Privacy Policy