Given an integer array of size N by the user. Print all the possible sets such that sum of all possible numbers equate to a number in the array.
Example:
Array A[]= {1,2,3,4,5}
1+2=3.Output:1,2,3
1+3=4。 产出:1,3,4
1+4=5。 产出:1,4,5
初步设计:
- Take a number and set it to SetSum
- Generate all sums excluding the selected number; checking that the formulated sum is same as the SetSum
- Print out the numbers that satisfies the conditions above.
- Iterate over the array and set the next number as SetSum
欢迎采用高效的设计/实施或不同的方法。