Share simple recursive java solution
my method is simple, try to output all combination of the list and skip the same integer.\n\n    public class Solution {\n    public List> subsetsWithDup(int[] 
my method is simple, try to output all combination of the list and skip the same integer.\n\n    public class Solution {\n    public List<List<Integer>> subsetsWithDup(int[] num) {\n        Arrays.sort(num);\n        List<List<Integer>> result = new LinkedList<List<Integer>>();\n        LinkedList<Integer> temp = new LinkedList<Integer>();\n        Rec(num,result,temp,0);\n        return result;\n    }\n    private static void Rec(int[] a,List<List<Integer>> result, LinkedList<Integer> temp, int current){\n        result.add(new LinkedList(temp));\n        for(int i=current;i<a.length;i++){\n            if(i==current || a[i]!=a[i-1]){\n                temp.add(a[i]);\n                Rec(a,result,temp,i+1);\n                temp.remove(temp.size()-1);\n            }\n        }\n        return;\n    }\n}
[]