Finding the maximum sum that can be formed from a set, by partitioning it into two subset
问题 Decription Given a set of numbers S. Find maximum sum such that Sum(A 1 ) = Sum(A 2 ) Where, A 1 ⊂S and A 2 ⊂S and A 1 ⋂A 2 =∅ And Sum(X), is the sum of all elements within the set X. Approach Brute Force The easiest approach is: print maximumSum(0,0,0) def maximumSum(index,sum1,sum2): ans=0 if sum1 == sum2: ans=sum1 if index >= len(S): return ans m1=maximumSum(index+1,sum1+S[index],sum2) m2=maximumSum(index+1,sum1,sum2+S[index]) m3=maximumSum(index+1,sum1,sum2) return max(m,m1,m2,m3) Time