352. Jump Game VII
MediumDynamic Programming
You are given a **0-indexed** binary string `s` and two integers `minJump` and `maxJump`. In the beginning, you are standing at index `0`, which is equal to `'0'`. You can move from index `i` to index `j` if the following conditions are fulfilled: - `i + minJump <= j <= min(i + maxJump, s.length - 1)`, and - `s[j] == '0'`. Return `true` if you can reach index `s.length - 1` in `s`, or `false` otherwise.
Examples
Input: 011010 2 3
Output: true
Explanation: 0→3 (jump 3, s[3]='0') then 3→5 (jump 2, s[5]='0') reaches the last index.
Constraints
- 2 <= s.length <= 10^5
- s[i] is either '0' or '1'.
- s[0] == '0'
- 1 <= minJump <= maxJump < s.length
Loading...
Run checks all cases above. Submit evaluates all test cases.