My solution using bit masks
Here is my solution using bit masks.\n\n    public class Solution {\n    public List> subsetsWithDup(int[] num) {\n        //Sort the input\n        Arrays.sort
Here is my solution using bit masks.\n\n    public class Solution {\n    public List<List<Integer>> subsetsWithDup(int[] num) {\n        //Sort the input\n        Arrays.sort(num);\n        int numberSets = 1 << num.length;\n        List<List<Integer>> solution = new LinkedList<>();\n        for(int i = 0; i<numberSets; i++){\n            List<Integer> subset = new LinkedList<Integer>();\n            for(int j = 0; j< num.length; j++){\n                if((i & (1 << j)) > 0){\n                    subset.add(num[j]);\n                }\n            }\n            if(!solution.contains(subset))\n                solution.add(subset);\n        }\n        \n        return solution;\n    }\n}
[]