3 ms·
Off the top of my head: 1. sum all the numbers 2. if the sum is odd, then return false 3. else determine if any set of numbers adds to half the sum
by chacham15 14y ago
Off the top of my head:
1. sum all the numbers
2. if the sum is odd, then return false
3. else determine if any set of numbers adds to half the sum
To determine if any set of numbers adds to half the sum:
1. choose a number and add it to the set
2. if the sum of the set is less than the number, add another number to the set
3. else remove a number from the set
which numbers to add and remove can be done via brute force, but there is probably a better way.
- deleted 14y ago[deleted]