Jump Game VII

Medium · Queue & Deque · about 25 minutes

Asked at Meta, Amazon, Bloomberg, Google.

s is a string of '0's and '1's that begins with '0'; let n be its length. You start at position 0 and may hop from position i to any position j with i + minJump <= j <= min(i + maxJump, n - 1), as long as s[j] is '0'. Decide whether you can land on the last position, n - 1.

Related guides