@@ -0,0 +1,1200 @@
+// Given a collection of integers that might contain duplicates, S, return all possible subsets.%0A%0A// Note:%0A// Elements in a subset must be in non-descending order.%0A// The solution set must not contain duplicate subsets.%0A// For example,%0A// If S = %5B1,2,2%5D, a solution is:%0A%0A// %5B%0A//   %5B2%5D,%0A//   %5B1%5D,%0A//   %5B1,2,2%5D,%0A//   %5B2,2%5D,%0A//   %5B1,2%5D,%0A//   %5B%5D%0A// %5D%0A%0Apublic class Solution %7B%0A    public List%3CList%3CInteger%3E%3E subsetsWithDup(int%5B%5D num) %7B%0A%09%09List%3CList%3CInteger%3E%3E result = new ArrayList%3CList%3CInteger%3E%3E();%0A%09%09List%3CInteger%3E tempList = new ArrayList%3CInteger%3E();%0A%09%09int len = num.length;%0A%0A%09%09if(len == 0) return result;%0A%0A%09%09Arrays.sort(num);%0A%0A%09%09for(int i = 0; i %3C= len; i++)%7B%0A%09%09%09dfs(result, tempList, num, i, 0);%0A%09%09%7D       %0A%0A%09%09return result;%0A    %7D%0A%0A    public void dfs(List%3CList%3CInteger%3E%3E result, List%3CInteger%3E tempList, int%5B%5D num, int len, int index)%7B%0A    %09if(index == len)%7B%0A    %09%09result.add(new ArrayList%3CInteger%3E(tempList));%0A    %09%09return;%0A    %09%7D%0A%0A    %09for(int i = index; i %3C num.length; i++)%7B%0A    %09%09tempList.add(num%5Bi%5D);%0A    %09%09dfs(result, tempList, num, len, i + 1);%0A    %09%09tempList.remove(tempList.size() - 1);%0A%0A    %09%09while(i %3C num.length - 1 && num%5Bi%5D == num%5Bi + 1%5D)%7B%0A    %09%09%09i++;%0A    %09%09%7D%0A    %09%7D%0A    %7D%0A%7D%0A%0A%0A%0A%0A%0A%0A%0A%0A%0A%0A%0A%0A

add subsets ii solution