Skip to content

Instantly share code, notes, and snippets.

@jeb2239
Created June 12, 2021 02:14
Show Gist options
  • Save jeb2239/a6602e23edff53946ed7e3e6afd787cd to your computer and use it in GitHub Desktop.
Save jeb2239/a6602e23edff53946ed7e3e6afd787cd to your computer and use it in GitHub Desktop.
class Solution:
def canJump(self, nums: List[int]) -> bool:
if len(nums)==1:
return True
minjump=1
idx=len(nums)-2
while idx >= 0:
if nums[idx]>=minjump:
minjump=1
else:
minjump+=1
idx-=1
if minjump > 1:
return False
return True
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment