

Check reachability backwards
idx as the current goal positionidx, move the goal to this index0, it means the start can reach the end → return Trueclass Solution:
def canJump(self, nums: List[int]) -> bool:
n = len(nums)
idx = n-1
for i in range(n-2, -1, -1):
if nums[i] >= idx - i:
idx = i
return idx == 0