Search
⌘K

Leetcode 1696. Jump Game VI

Find the maximum sum you can collect jumping from index 0 to n-1 when each move can advance at most k steps; this reduces to DP with the recurrence dp[i] = nums[i] + max(dp[j]) for j in [i-k, i-1], requiring an efficient sliding-window maximum (monotonic queue/heap) to run in near-linear time for large n.


Question Timeline

See when this question was last asked and where, including any notes left by other candidates.

Comments

Your account is free and you can post anonymously if you choose.