#C10564. All Unique Subsets
All Unique Subsets
All Unique Subsets
Given an integer array, generate all possible unique subsets (i.e., the power set) of the array. The solution set must not contain duplicate subsets. The subsets can be returned in any order.
In this problem, you need to read the input from standard input (stdin) and print the resulting subsets to standard output (stdout). Each subset should be printed on a separate line with its elements separated by a single space. For the empty subset, output an empty line.
The answer should be implemented using backtracking, and if there are multiple answers, any order is acceptable.
inputFormat
The first line contains an integer (n), representing the number of elements in the array. The second line contains (n) space-separated integers.
outputFormat
Print all possible unique subsets, one per line. For each subset, print its elements separated by a single space. For the empty subset, print an empty line.## sample
3
1 2 3
1
1 2
1 2 3
1 3
2
2 3
3
</p>