1871. Jump Game VII Medium
1/**
2 * [1871] Jump Game VII
3 *
4 * 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:
5 *
6 * i + minJump <= j <= min(i + maxJump, s.length - 1), and
7 * s[j] == '0'.
8 *
9 * Return true if you can reach index s.length - 1 in s, or false otherwise.
10 *
11 * Example 1:
12 *
13 * Input: s = "<u>0</u>11<u>0</u>1<u>0</u>", minJump = 2, maxJump = 3
14 * Output: true
15 * Explanation:
16 * In the first step, move from index 0 to index 3.
17 * In the second step, move from index 3 to index 5.
18 *
19 * Example 2:
20 *
21 * Input: s = "01101110", minJump = 2, maxJump = 3
22 * Output: false
23 *
24 *
25 * Constraints:
26 *
27 * 2 <= s.length <= 10^5
28 * s[i] is either '0' or '1'.
29 * s[0] == '0'
30 * 1 <= minJump <= maxJump < s.length
31 *
32 */
33pub struct Solution {}
34
35// problem: https://leetcode.com/problems/jump-game-vii/
36// discuss: https://leetcode.com/problems/jump-game-vii/discuss/?currentPage=1&orderBy=most_votes&query=
37
38// submission codes start here
39
40impl Solution {
41 pub fn can_reach(s: String, min_jump: i32, max_jump: i32) -> bool {
42 false
43 }
44}
45
46// submission codes end
47
48#[cfg(test)]
49mod tests {
50 use super::*;
51
52 #[test]
53 fn test_1871() {
54 }
55}
56
Back
© 2025 bowen.ge All Rights Reserved.