Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #Solutie O(n) - py
- class Solution:
- def jump(self, nums: List[int]) -> int:
- dp = [0 for i in range(len(nums))]
- p = 1
- for i in range(len(nums)):
- while p <= nums[i] + i and p < len(nums):
- dp[p] = dp[i] + 1
- p = p + 1
- return dp[len(nums) - 1]
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement