Java | simple recursion
\n public List<List<Integer>> subsetsWithDup(int[] nums) {\n        Arrays.sort(nums);\n        Set<List<Integer>>  result =new HashSet<>();\n        solve(nums
```\n public List<List<Integer>> subsetsWithDup(int[] nums) {\n        Arrays.sort(nums);\n        Set<List<Integer>>  result =new HashSet<>();\n        solve(nums,0,new ArrayList<Integer>(),result);\n        return new ArrayList<>(result);\n    }\n    \n    public void solve(int[] arr,int pos,ArrayList<Integer> op,Set<List<Integer>> result){\n        if(pos==(arr.length)){\n            result.add(op);\n            return;\n        }\n     \n        ArrayList<Integer> op1=new ArrayList<>();\n        op1.addAll(op);\n        op1.add(arr[pos]);\n        solve(arr,pos+1,op1,result);\n        solve(arr,pos+1,op,result);\n        return;\n\n    }\n```
['Recursion', 'Java']