@@ -0,0 +1,1593 @@
+public class Solution %7B%0A    private Set%3CList%3CInteger%3E%3E list;%0A    public List%3CList%3CInteger%3E%3E subsetsWithDup(int%5B%5D nums) %7B%0A        Arrays.sort(nums);%0A        list = new HashSet%3CList%3CInteger%3E%3E();%0A        subset(nums);%0A        return new ArrayList(list);%0A    %7D%0A    %0A    private void subset(int%5B%5D s) %7B%0A        backtrack(new int%5Bs.length%5D, 0, s);%0A    %7D%0A    %0A    /*%0A     * The first k-1 indices is stored in a, here we need to choose the kth%0A     * element;%0A     */%0A    private void backtrack(int%5B%5D a, int k, int%5B%5D s) %7B%0A        // if we reach the end;%0A        if (is_a_solution(a, k, s)) %7B%0A            process_solution(a, k, s);%0A            return;%0A        %7D%0A        %0A        int%5B%5D candidates = construct_candidates(a, k, s);%0A        for (int i = 0; i %3C candidates.length; i++) %7B%0A            a%5Bk%5D = candidates%5Bi%5D;%0A            backtrack(a, k + 1, s);%0A        %7D%0A    %7D%0A    %0A    private int%5B%5D construct_candidates(int%5B%5D a, int k, int%5B%5D s) %7B%0A        // Only two possibility exists;%0A        return new int%5B%5D %7B 0, 1 %7D;%0A    %7D%0A    %0A    /*%0A     * Process the permutation, which is the array of the indices;%0A     */%0A    private void process_solution(int%5B%5D a, int k, int%5B%5D s) %7B%0A        List%3CInteger%3E num = new ArrayList%3CInteger%3E();%0A        for (int i = 0; i %3C s.length; i++) %7B%0A            if (a%5Bi%5D == 1) %7B%0A                num.add(s%5Bi%5D);%0A            %7D%0A        %7D%0A        // Collections.sort(num);%0A        this.list.add(num);%0A    %7D%0A    %0A    private boolean is_a_solution(int%5B%5D a, int k, int%5B%5D s) %7B%0A        // Reach the limit, which there is no element here;%0A        int n = s.length;%0A        return k == n;%0A    %7D%0A%7D%0A

Create SubsetsII.java