Given a set of integers, find distinct sum that can be generated from the subsets of the given sets and print them in an increasing order. It is given that sum of array elements is small.
The first line of input contains an integer T denoting the number of test cases. Then T test cases follow. The first line of each test case contains an integer N denoting the size of array A.
The second line of each test case contains N space separated integers denoting elements of the array A[ ].
Print all the distinct sum that can be generated from the subsets in increasing order for each testcase in a new line.
1<= T <=100
1<= N <=100
1<= A[ ] <=100
2 3 4 5 6
0 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
If you have purchased any course from GeeksforGeeks then please ask your doubt on course discussion forum. You will get quick replies from GFG Moderators there.