Question
Power Set Generation
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.
Input
User Task:
Since this will be a functional problem, you don't have to take input. You just have to complete the function subsetsWithDup() that takes Integer array "nums" as parameter.
Custom Input
The first line of the input contains integer n, representing the size of the array "nums"
The second line of the input contains n space separated integers representing elements of the array "nums".
Since this will be a functional problem, you don't have to take input. You just have to complete the function subsetsWithDup() that takes Integer array "nums" as parameter.
Custom Input
The first line of the input contains integer n, representing the size of the array "nums"
The second line of the input contains n space separated integers representing elements of the array "nums".
Output
Return a list of subsets in any order.
Example
Input:
3
1 2 2
Output:
[[],[1],[1,2],[1,2,2],[2],[2,2]]
Explanation:
The power set is [[],[1],[1,2],[1,2,2],[2],[2,2]].
3
1 2 2
Output:
[[],[1],[1,2],[1,2,2],[2],[2,2]]
Explanation:
The power set is [[],[1],[1,2],[1,2,2],[2],[2,2]].