Subsets
Medium
Given an integer array nums of unique elements, return every possible subset (the power set). The order of the subsets does not matter; keep the elements within each subset in input order.
Examples:
Example 1:
Input:[1, 2, 3]
Output:[[], [1], [2], [1, 2], [3], [1, 3], [2, 3], [1, 2, 3]]
Explanation:There are 2^3 = 8 subsets. Their order in the output is arbitrary.
Constraints:
- 0 <= nums.length <= 10
- -10 <= nums[i] <= 10
- All values in nums are unique
Limits:
Time limit: 1000 ms
Memory limit: 128 MB
Topics
Backtracking
Loading editor...
▶
Run your code to test against examples