Skip to content

Commit

Permalink
Update 0055.跳跃游戏.md
Browse files Browse the repository at this point in the history
python for循环版,添加了更新cover的条件
  • Loading branch information
roylx authored Nov 15, 2022
1 parent 6fb61ea commit c0f1f13
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions problems/0055.跳跃游戏.md
Original file line number Diff line number Diff line change
Expand Up @@ -126,8 +126,9 @@ class Solution:
cover = 0
if len(nums) == 1: return True
for i in range(len(nums)):
cover = max(i + nums[i], cover)
if cover >= len(nums) - 1: return True
if i <= cover:
cover = max(i + nums[i], cover)
if cover >= len(nums) - 1: return True
return False
```

Expand Down

0 comments on commit c0f1f13

Please sign in to comment.