Untitled
unknown
plain_text
7 months ago
376 B
8
Indexable
class Solution:
def canJump(self, nums: List[int]) -> bool:
max_reach = nums[0]
for i in range(len(nums)) :
if max_reach < i :
return False
iter_reach=i+nums[i]
max_reach = max(max_reach,iter_reach)
if max_reach >= len(nums)-1 :
return True
return False
Editor is loading...
Leave a Comment