49. Subsets (Power Set)
MediumRecursion & backtracking
Given distinct integers nums, return every subset. Sort the numbers inside each subset ascending, and sort the list of subsets by length, then lexicographically.
Example 1
Input: nums = [1, 2, 3] Output: [[], [1], [2], [3], [1, 2], [1, 3], [2, 3], [1, 2, 3]]
Constraints
0 ≤ nums.length ≤ 10Values are distinct