330. Jump Game III
MediumBFS
Given an array of non-negative integers `arr`, you are initially positioned at `start` index of the array. When you are at index `i`, you can jump to `i + arr[i]` or `i - arr[i]`, checking that the new index is within the bounds of the array. Notice that you can not jump outside of the array at any time. Return `true` if you can reach **any** index with value `0`, otherwise return `false`.
Examples
Input: [4,2,3,0,3,1,2] 5
Output: true
Explanation: 5→4→1→3 reaches index 3 whose value is 0.
Constraints
- 1 <= arr.length <= 5 * 10^4
- 0 <= arr[i] < arr.length
- 0 <= start < arr.length
Loading...
Run checks all cases above. Submit evaluates all test cases.