Skip to content

Commit c0f1f13

Browse files
authored
Update 0055.跳跃游戏.md
python for循环版,添加了更新cover的条件
1 parent 6fb61ea commit c0f1f13

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

problems/0055.跳跃游戏.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -126,8 +126,9 @@ class Solution:
126126
cover = 0
127127
if len(nums) == 1: return True
128128
for i in range(len(nums)):
129-
cover = max(i + nums[i], cover)
130-
if cover >= len(nums) - 1: return True
129+
if i <= cover:
130+
cover = max(i + nums[i], cover)
131+
if cover >= len(nums) - 1: return True
131132
return False
132133
```
133134

0 commit comments

Comments
 (0)