8000 New Problem Solution - "1871. Jump Game VII" · royeLin/leetcode_cpp@c19a4bb · GitHub
[go: up one dir, main page]

Skip to content

Commit c19a4bb

Browse files
committed
New Problem Solution - "1871. Jump Game VII"
1 parent 28617d1 commit c19a4bb

File tree

2 files changed

+38
-0
lines changed

2 files changed

+38
-0
lines changed

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ LeetCode
99

1010
| # | Title | Solution | Difficulty |
1111
|---| ----- | -------- | ---------- |
12+
|1871|[Jump Game VII](https://leetcode.com/problems/jump-game-vii/) | [C++](./algorithms/cpp/jumpGame/jumpGame.VII.cpp)|Medium|
1213
|1870|[Minimum Speed to Arrive on Time](https://leetcode.com/problems/minimum-speed-to-arrive-on-time/) | [C++](./algorithms/cpp/minimumSpeedToArriveOnTime/MinimumSpeedToArriveOnTime.cpp)|Medium|
1314
|1869|[Longer Contiguous Segments of Ones than Zeros](https://leetcode.com/problems/longer-contiguous-segments-of-ones-than-zeros/) | [C++](./algorithms/cpp/longerContiguousSegmentsOfOnesThanZeros/LongerContiguousSegmentsOfOnesThanZeros.cpp)|Easy|
1415
|1862|[Sum of Floored Pairs](https://leetcode.com/problems/sum-of-floored-pairs/) | [C++](./algorithms/cpp/sumOfFlooredPairs/SumOfFlooredPairs.cpp)|Hard|
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
// Source : https://leetcode.com/problems/jump-game-vii/
2+
// Author : Hao Chen
3+
// Date : 2021-05-30
4+
5+
/*****************************************************************************************************
6+
*
7+
* You are given a 0-indexed binary string s and two integers minJump and maxJump. In the beginning,
8+
* you are standing at index 0, which is equal to '0'. You can move from index i to index j if the
9+
* following conditions are fulfilled:
10+
*
11+
* i + minJump <= j <= min(i + maxJump, s.length - 1), and
12+
* s[j] == '0'.
13+
*
14+
* Return true if you can reach index s.length - 1 in s, or false otherwise.
15+
*
16+
* Example 1:
17+
*
18+
* Input: s = "011010", minJump = 2, maxJump = 3
19+
* Output: true
20+
* Explanation:
21+
* In the first step, move from index 0 to index 3.
22+
* In the second step, move from index 3 to index 5.
23+
*
24+
* Example 2:
25+
*
26+
* Input: s = "01101110", minJump = 2, maxJump = 3
27+
* Output: false
28+
*
29+
* Constraints:
30+
*
31+
* 2 <= s.length <= 10^5
32+
* s[i] is either '0' or '1'.
33+
* s[0] == '0'
34+
* 1 <= minJump <= maxJump < s.length
35+
******************************************************************************************************/
36+
37+

0 commit comments

Comments
 (0)
0