Tap here to switch tabs
Problem
Submissions

Problem: Jump Game III

Try to solve the Jump Game III problem.

Statement

Given an array of non negative integers arr and a starting position start, determine if you can reach any index with a value equal to 00.

When located at index i, you are allowed to jump to i + arr[i] or i - arr[i], provided that the destination index remains within the bounds of the array.

Return true if it is possible to reach any index where arr[i] equals 00, or false otherwise.

Constraints:

  • 1≤1 \leq arr.length ≤5×104\leq 5 \times 10^4

  • 0≤0 \leq arr[i] << arr.length

  • 0≤0 \leq start << arr.length

⋮
Tap here to switch tabs
Problem
Submissions

Problem: Jump Game III

Try to solve the Jump Game III problem.

Statement

Given an array of non negative integers arr and a starting position start, determine if you can reach any index with a value equal to 00.

When located at index i, you are allowed to jump to i + arr[i] or i - arr[i], provided that the destination index remains within the bounds of the array.

Return true if it is possible to reach any index where arr[i] equals 00, or false otherwise.

Constraints:

  • 1≤1 \leq arr.length ≤5×104\leq 5 \times 10^4

  • 0≤0 \leq arr[i] << arr.length

  • 0≤0 \leq start << arr.length