83. Subsets II

MediumBacktracking

Given an integer array nums that may contain duplicates, return all possible subsets (the power set). The solution set must not contain duplicate subsets. Return the solution in any order.

Examples

Input: [1,2,2]

Output: [[],[1],[1,2],[1,2,2],[2],[2,2]]

Explanation: The duplicate 2 would produce [2] twice; level-wise skipping keeps only unique subsets.

Constraints

  • 1 <= nums.length <= 10
  • -10 <= nums[i] <= 10
Loading...

Run checks all cases above. Submit evaluates all test cases.