Given an integer array nums and an integer k, return the maximum sum of a non-empty subsequence of nums such that for every two consecutive elements in the subsequence with original indices i and j (where i j), the condition j i k is satisfied.
Note: A subsequence of an array is obtained by deleting zero or more elements from the array without changing the relative order of the remaining elements.
Constraints:
k nums.length
nums[i]
Given an integer array nums and an integer k, return the maximum sum of a non-empty subsequence of nums such that for every two consecutive elements in the subsequence with original indices i and j (where i j), the condition j i k is satisfied.
Note: A subsequence of an array is obtained by deleting zero or more elements from the array without changing the relative order of the remaining elements.
Constraints:
k nums.length
nums[i]