Tap here to switch tabs
Problem
Submissions

Problem: Jump Game VII

med
30 min
Try to solve the Jump Game VII problem.

Statement

You are given a binary string s indexed from 00, along with two integers minJump and maxJump. You are initially positioned at index 00, where s[0] is guaranteed to be '0'.

In each move, you can jump from your current index i to a target index j if both of the following conditions hold:

  • i + minJump ≤\leq j ≤min⁡(\leq \min(i + maxJump, s.length −1)- 1)

  • s[j] == '0'

Return true if you can reach index s.length −1- 1, or false otherwise.

Constraints:

  • 2≤2 \leq s.length ≤105\leq 10^5

  • s[i] is either '0' or '1'.

  • s[0] == '0'

  • 1≤1 \leq minJump ≤\leq maxJump << s.length

⋮
Tap here to switch tabs
Problem
Submissions

Problem: Jump Game VII

med
30 min
Try to solve the Jump Game VII problem.

Statement

You are given a binary string s indexed from 00, along with two integers minJump and maxJump. You are initially positioned at index 00, where s[0] is guaranteed to be '0'.

In each move, you can jump from your current index i to a target index j if both of the following conditions hold:

  • i + minJump ≤\leq j ≤min⁡(\leq \min(i + maxJump, s.length −1)- 1)

  • s[j] == '0'

Return true if you can reach index s.length −1- 1, or false otherwise.

Constraints:

  • 2≤2 \leq s.length ≤105\leq 10^5

  • s[i] is either '0' or '1'.

  • s[0] == '0'

  • 1≤1 \leq minJump ≤\leq maxJump << s.length