Maximum and Minimum Sums of at Most Size K Subarrays
Extend each subarray start up to k elements while tracking its running minimum and maximum, and add both to the total.
Extend each subarray start up to k elements while tracking its running minimum and maximum, and add both to the total.