Subsets II
Return all distinct subsets of nums, which may contain duplicate values. Include the empty subset and do not repeat equivalent multisets.
Example 1
nums = [1,2,2][[],[1],[2],[1,2],[2,2],[1,2,2]]Explanation
Choose zero or one 1 and zero, one or two 2s, giving six multisets.
Example 2
nums = [0,0][[],[0],[0,0]]Explanation
Equal zeroes give only [], [0], [0,0], without duplicate singletons.
Example 3
nums = [][[]]Explanation
The empty array has only the empty subset.
Constraints
- 0 <= len(nums) <= 10
Function contract
subsetsWithDupArguments: jsonSolutionRuns on your device
Loading draft…
Run: 3 examples; Submit: 34 cases, on your device.
[1,2,2]