55. Jump Game
mediumArray · Dynamic Programming · Greedy
read the problem on leetcode →
first solved 9 Sept 2026
class Solution:
def canJump(self, nums: List[int]) -> bool:
farthest = 0
for i in range(len(nums)):
if i > farthest:
return False
farthest = max(farthest, i + nums[i])
if farthest >= len(nums) - 1:
return True
return True