45. Jump Game II
mediumArray · Dynamic Programming · Greedy
read the problem on leetcode →
first solved 9 Sept 2026
class Solution:
def jump(self, nums: List[int]) -> int:
curr_end=0
far=0
jumps=0
for i in range(len(nums)-1):
far=max(far,nums[i]+i)
if i==curr_end:
jumps+=1
curr_end=far
return jumps