Given an integer array nums that may contain duplicates, return all possible subsets (the power set). The solution set must not contain duplicate subsets.
Input: nums = [1,2,2]
Output: [[],[1],[1,2],[1,2,2],[2],[2,2]]
Topics: backtracking, arrays
Asked by: Amazon, Google, Meta, Microsoft
Time complexity: O(n × 2^n). Space complexity: O(n × 2^n).