Split an array into K contiguous subarrays with minimum total cost.
Unlock detailed company stats for this questionUpgrade
Given an array and a required number of partitions, split the array into that many non-empty subarrays. The cost of each split is computed from the values at the split indices (start and end). Find the maximum and minimum possible total cost.
Example: array = [1, 3, 5, 10], numPartitions = 2. cost([1,3]) = 1+3 = 4, cost([5,10]) = 5+10 = 15, total cost = 19.
It was a greedy problem.
Also asked as · Split an array into k non-empty subarrays and find the minimum and maximum total cost.
Community answers
No answers contributed by the community yet.



