Back to DSA
Subsets
mediumGiven an array of distinct integers, enumerate every possible subset (the power set). The output must not contain duplicate subsets and may be listed in any order.
Examples
Example 1:
Input:
nums = [4,5,6]Output:
[[],[4],[5],[4,5],[6],[4,6],[5,6],[4,5,6]] Example 2:
Input:
nums = [1]Output:
[[],[1]]Hints
1234567