1871. Jump Game VII
Practice Jump Game VII for free on NudgeCode: Medium, Greedy pattern. Write it in Python or JavaScript, run the tests in your browser, and ask for a hint when you are stuck.
s is a binary string with s[0] == '0'. From index i you may jump to any index j with i + minJump <= j <= i + maxJump, but only if s[j] == '0'. Starting at index 0, return true if you can reach the last index.
Example
s = "011010", minJump = 2, maxJump = 3 -> true (0 -> 3 -> 5)
s = "01101110", minJump = 2, maxJump = 3 -> false
Constraints
- 2 <= s.length <= 10^5
- s[0] == '0'
- 1 <= minJump <= maxJump < s.length