五月天青色头像情侣网名,国产亚洲av片在线观看18女人,黑人巨茎大战俄罗斯美女,扒下她的小内裤打屁股

歡迎光臨散文網(wǎng) 會員登陸 & 注冊

LeetCode1871. Jump Game VII

2023-04-09 09:06 作者:您是打尖兒還是住店呢  | 我要投稿

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:

  • i + minJump <= j <= min(i + maxJump, s.length - 1), and

  • s[j] == '0'.

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

?

Example 1:

Input: s = "011010", minJump = 2, maxJump = 3

Output: trueExplanation:In the first step, move from index 0 to index 3. In the second step, move from index 3 to index 5.

Example 2:

Input: s = "01101110", minJump = 2, maxJump = 3

Output: false

?

Constraints:

  • 2 <= s.length <= 105

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

  • s[0] == '0'

  • 1 <= minJump <= maxJump < s.length

  • 能過就不奢求了,用dp,只要在i-maxJump 到i-minJump中有一個是true,那么就一定能跳到i,所以dp[i]就一定是true,這里要break一下,不然又要TLE了。。。

Runtime:?2804 ms, faster than?5.06%?of?Java?online submissions for?Jump Game VII.

Memory Usage:?43 MB, less than?85.63%?of?Java?online submissions for?Jump Game VII.


LeetCode1871. Jump Game VII的評論 (共 條)

分享到微博請遵守國家法律
武威市| 嘉义县| 渑池县| 如东县| 富源县| 遂宁市| 丹江口市| 绥宁县| 桂阳县| 秭归县| 资兴市| 泸溪县| 高清| 彭州市| 吉安市| 泰安市| 瓦房店市| 寿阳县| 新疆| 于都县| 内黄县| 吉林省| 清涧县| 高平市| 广安市| 潜山县| 宁阳县| 宾阳县| 太仆寺旗| 镇康县| 新建县| 苍南县| 扎兰屯市| 丽江市| 永平县| 四平市| 邛崃市| 万州区| 游戏| 洪泽县| 博客|