Java BACKTRACKING [easy to understand] [Explanation]
\n\n    public List<List<Integer>> subsetsWithDup(int[] nums) {\n        List<List<Integer>> resultList=new ArrayList();\n        Arrays.sort(nums);\n        ba
\n```\n    public List<List<Integer>> subsetsWithDup(int[] nums) {\n        List<List<Integer>> resultList=new ArrayList();\n        Arrays.sort(nums);\n        backTrack(resultList,new ArrayList(),nums,0);\n        return resultList;\n    }\n    \n    private void backTrack(List<List<Integer>> resultList, List<Integer> currentList, int []nums, int start) {\n\t    resultList.add(new ArrayList(currentList));\n        for(int i=start;i<nums.length;i++)  {\n            if(i>start&&nums[i]==nums[i-1]) continue; // to avoid duplicates\n            currentList.add(nums[i]);\n            backTrack(resultList,currentList,nums,i+1);\n            currentList.remove(currentList.size()-1);\n        }\n    }\n}\n```\nIf you can follow the Numbers and the arrows you will get the idea \nif you didn\'t understand any point let me know and will try to explain it again\n\n![image](https://assets.leetcode.com/users/images/d81b304b-f002-4049-a57b-d0513f8f714b_1594493500.5942798.png)\n
['Backtracking', 'Java']