How to solve this DP problem?

Revision en2, by GODOF_Shinobi, 2018-07-30 02:20:12

This question was asked in a hiring round. As the round is over I am asking the question. Given N elements and a positive integer K divide the array into K segments/sub arrays such that maximum of sum of segments — minimum of sum of segments is minimized. Example given N=6 and K=3 a[]={7,2,3,1,2,3} .First segment is 7 ,Second is 2,3 and the Third is 1,2,3 .Max of {7,5,6} — Min of {7,5,6} = 2. While the N is pretty small. I would be thankful to any and all solutions possible.

History

 
 
 
 
Revisions
 
 
  Rev. Lang. By When Δ Comment
en2 English GODOF_Shinobi 2018-07-30 02:20:12 10 Tiny change: 'of {7,5,6}- Min of{7,5,6} = ' -> 'of {7,5,6} - Min of {7,5,6} = '
en1 English GODOF_Shinobi 2018-07-30 02:18:47 513 Initial revision (published)