parent
4261d96a14
commit
6fb61ead0b
|
|
@ -119,6 +119,18 @@ class Solution:
|
||||||
return False
|
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
|
||||||
```Go
|
```Go
|
||||||
func canJUmp(nums []int) bool {
|
func canJUmp(nums []int) bool {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue