How to find the minimum sum of range of k partitio

2019-09-07 07:31发布

问题:

There is an array A of size n. We are given the number of partitions k. How to find the minimum sum of range of all partitions? Range is difference between maximum and mimimum element in that partition. For eg. A={20, 30, 40, 41, 45}, k = 4. The minimum possible sum of range of all partitions is 1.