How do you find mimum sum of maximum of subarrays of size atmost k?

for ex:
n=4 k=2
1 5 5 2
answer: 1+5+2=8 -> [1],[5,5],[2]

Comments (2)