You are given an integer array nums and two integers k and mul.
You need to select exactly k elements from nums and choose the order in which to process them.
For each selected element, you can perform one of the following operations:
Multiply the element by the current value of mul, add the resulting product to the total sum, and then decrease mul by
Add the element directly to the total sum without modifying mul.
Return the maximum possible total sum that can be obtained after processing all k selected elements.
Constraints:
nums.length
nums[i]
k nums.length
mul
You are given an integer array nums and two integers k and mul.
You need to select exactly k elements from nums and choose the order in which to process them.
For each selected element, you can perform one of the following operations:
Multiply the element by the current value of mul, add the resulting product to the total sum, and then decrease mul by
Add the element directly to the total sum without modifying mul.
Return the maximum possible total sum that can be obtained after processing all k selected elements.
Constraints:
nums.length
nums[i]
k nums.length
mul