0

The problem is the following:

You are given a set of positive integers { a1 , a2 , a3 , ... , an } in which there may be repeated numbers eg A = {6, 30, 3, 11, 3}. I have to split the numbers into two subsets so that the sum of all the numbers in each subset is equal to the sub of the numbers in the other subset.

Tricky part: I can leave some numbers from the original set out of the two subsets in order to achieve this. The only thing I have to return is the sum of the numbers that I leave out, for example, with A = {6, 30, 3, 11, 3}, I would have: A1 = {6} A2 = {3, 3}

And I would return 11 + 30 = 41.

I just need to return the value 41, the thing is that 41 has to be the lowest value possible. Unfortunately, I have no idea how to do this, any ideas?

Smiley
  • 107
  • 1
  • 1
  • 9
  • 1
    Is this a homework question? Someone asked virtually the same question about an hour ago: http://stackoverflow.com/questions/31819009/finding-maximum-valued-subset-in-which-partitionproblem-algorithm-returns-true – templatetypedef Aug 04 '15 at 22:10
  • There is a programming contest in my college, that was probably one of the other contestants. This was one from the problems we were given to practice for the contest. – Smiley Aug 04 '15 at 22:13

0 Answers0