Skip to content

Commit

Permalink
Update 0055.跳跃游戏.md
Browse files Browse the repository at this point in the history
增加Python for循环版
  • Loading branch information
roylx authored Nov 15, 2022
1 parent 4261d96 commit 6fb61ea
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions problems/0055.跳跃游戏.md
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,18 @@ class Solution:
return False
```

```python
## for循环
class Solution:
def canJump(self, nums: List[int]) -> bool:
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
return False
```

### Go
```Go
func canJUmp(nums []int) bool {
Expand Down

0 comments on commit 6fb61ea

Please sign in to comment.