Subsets With Duplicates

Return all possible subsets of an integer array that may contain duplicate elements. The result must not contain any duplicate subsets, even though the input may have repeated values.

Examples
Input: [1,2,2]
Output: [[],[1],[2],[1,2],[2,2],[1,2,2]]
Hints

Subsets With Duplicates

Return all possible subsets of an integer array that may contain duplicate elements. The result must not contain any duplicate subsets, even though the input may have repeated values.