Given an array of scores and a jump limit k, return the maximum score you can obtain when moving from the first index to the last. Pattern focus: Deque for Sliding Window Maximum. Keep the best dynamic programming states in a monotonic deque so each transition looks only at the useful candidates.
nums = score array, k = maximum jump length
maximum score obtainable at the last index
Example 1:
Input:
nums = [1,-1,-2,4,-7,3] k = 2
Output:
7
Explanation:
The optimal path accumulates a total score of 7.
Example 2:
Input:
nums = [10,-5,-2,4,0,3] k = 3
Output:
17
Explanation:
The best route uses high-scoring jumps within the limit.