045. Jump Game II
Last updated
Last updated
(Jump Game II -> )
Given an array of non-negative integers, you are initially positioned at the first index of the array.Each element in the array represents your maximum jump length at that position. Your goal is to reach the last index in the minimum number of jumps.
Example:
以“位置”為判斷是否抵達標準, 可抵達之最後位置(end)超過 nums 的最後一位(總長度 - 1)
每次跳躍(step + 1),重新定義要檢查的 start, end start : 上次可跳躍範圍 + 1 end:本次跳躍可跳最遠的位置