jump_game
jump_game.py 源码
from typing import List
# 跳跃游戏
class Solution:
def canJump(self, nums: List[int]) -> bool:
k = 0
for i in range(len(nums)):
if i > k:
return False
k = max(k, i + nums[i])
return True
你可能感兴趣的文章
0
赞