DP problem looks like Knapsack variant

Revision en1, by glow, 2023-06-21 20:58:12

Given a positive integer array partition array into M subarray such that when we take sum of each subarray and chose maximum it is minimal across all subarray combinations.

I tried drawing all combinations when M=1, M=2... but couldn't find DP pattern. Some help will be greatly appreciated.

Input array : [7,2,3,4,5] and M = 3
Optimal partitioning : [7], [2,3,4], [5]
Answer Max(7, 2+3+4, 5) = 9

Input array : [4,3,2,2,2,6] and M = 3
Optimal partitioning : [4,3], [2,2,2], [6]
Answer Max(4+3, 2+2+2, 6) = 7
Tags dp

History

 
 
 
 
Revisions
 
 
  Rev. Lang. By When Δ Comment
en1 English glow 2023-06-21 20:58:12 584 Initial revision (published)