Hi guys,

this is my solution

```
public class Solution {
List<List<Integer>> res = new ArrayList<>();
public List<List<Integer>> subsetsWithDup(int[] nums) {
Arrays.sort(nums);
helper(0, nums, new ArrayList<Integer>());
return res;
}
public void helper (int ind, int[] nums, List<Integer> cur) {
res.add(cur);
List<Integer> temp = new ArrayList<Integer>(cur);
for (int i = ind; i < nums.length; i++) {
if (i == ind || nums[i] != nums[i - 1]) {
temp.add(nums[i]);
helper(i + 1, nums, temp);
temp.remove(temp.size() - 1);
}
}
}
```

}

I think it is right, but when I run [1, 2, 2] the result is [[],[],[1],[1,2],[],[2]] which is so weird, could anyone tell me why?