KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
Folks, came across a problem... found this intersting... am modifying it a little bit just tu pep it up. Given a set of integers (range 0-500), find the minimum difference between the sum of two subsets that can be formed by splitting them almost equally. (say count of integers is n, if n is even, each set must have n/2 elements and if n is odd, one set has (n-1)/2 elements and other has (n+1)/2 elements) sample imput : 1 2 3 4 5 6 minimal difference = 1 (subsets being 1 4 6 and 2 3 5 ) sample input 2 : [ 1 1 1 1 2 2 2 2 ] minimal difference = 0 (subsets being 1 1 2 2 and 1 1 2 2 ) is there DP approach for this problem. Thanks guys... raj...
Tags (comma-separated)
Save Edits
Cancel