55. Jump Game

202402061027
tags: #greedy

class Solution:
	def canJump(self, nums: List[int]) -> bool:
		remainingDistance = nums[0]
		for i in range(1, len(nums)):
			if remainingDistance == 0:
				return False
			remainingDistance -= 1
			remainingDistance = max(remainingDistance, nums[i])
		return True

Reference

https://leetcode.com/problems/jump-game/