You are given an integer array nums and an integer k.
Calculate the sum of the minimum and maximum values of all contiguous subarrays of nums that have a size of at most k.
Return the sum of the minimum and maximum elements across all such subarrays.
Constraints:
nums.length
k nums.length
nums[i]
You are given an integer array nums and an integer k.
Calculate the sum of the minimum and maximum values of all contiguous subarrays of nums that have a size of at most k.
Return the sum of the minimum and maximum elements across all such subarrays.
Constraints:
nums.length
k nums.length
nums[i]