BETA

Submissions : 1195 Accuracy :

24.27

Subset Sums
     

Given an array of integers, print sums of all subsets in it. Output should be printed in increasing order of sums.

Input : arr[] = {2, 3}
Output: 0 2 3 5

Input : arr[] = {2, 4, 5}
Output : 0 2 4 5 6 7 9 11

Input:

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 is N, N is the size of array. The second line of each test case contains N space separated values of the array arr[].

Output:

Output for each test case should be space separated sums in increasing order.

Constraints:

1 ≤ T ≤ 100
1 ≤ N ≤ 10
0 ≤ A[i] ≤ 100

Input:
2
2
1 2
3
5 2 1

Output:

0 1 2 3 
0 1 2 3 5 6 7 8 

**For More Examples Use Expected Output**


Set Default Code

					   
Result:
It is recommended to test your code before clicking 'Submit' button!



                   



Need help with your code? Please use ide.geeksforgeeks.org, generate link and share the link here.