Problem of the day
You are given an array ‘arr’ of ‘N’ distinct integers. Your task is to print all the non-empty subsets of the array.
Note: elements inside each subset should be sorted in increasing order. But you can print the subsets in any order, you don’t have to specifically sort them.
1 <= T <= 10
1 <= N <= 10
10^-9 <= arr[i] <= 10^9
Time limit: 1 sec
2
3
1 2 3
1
10
1
1 2
1 2 3
1 3
2
2 3
3
10
For test case 1 :
Total 7 possible subsets can be formed: {1}, {1,2}, {1,2,3}, {1,3}, {2}, {2,3}, {3}
For test case 2 :
Only a single subset {10} is possible for the given input array.
2
2
1 2
3
1 2 3
1
1 2
2
1
1 2
1 2 3
1 3
2
2 3
3