All subsets
Mediumbacktrackingrecursionbit manipulation
nums has distinct values. Return every possible subset (including the empty and the full one). Order doesn't matter.
Example 1
Input: nums = [1,2,3] Output: [[],[1],[2],[3],[1,2],[1,3],[2,3],[1,2,3]]
Example 2
Input: nums = [0] Output: [[],[0]]
Constraints
- 0 ≤ nums.length ≤ 10
- Values are distinct
Submit checks your solution against 7 tests, including hidden ones.
/**
* @param {int[]} nums
* @return {int[][]}
*/
function subsets(nums) {
}