package leetcode;

import java.util.List;

/**
 * https://leetcode.com/problems/subsets/
 */
public class Problem78 {
    public List<List<Integer>> subsets(int[] nums) {
        return null;
    }
    
    public static void main(String[] args) {
        Problem78 prob = new Problem78();
        for (List<Integer> list : prob.subsets(new int[]{1, 2, 3})) {
            System.out.println(list);
        }
    }
}

@@ -33,216 +33,756 @@
 til.
+Array
 List;%0A
-%0A/**%0A * https://leetcode.com/problems/subsets/%0A */%0Apublic class Problem78 %7B%0A    public List%3CList%3CInteger%3E%3E subsets(int%5B%5D nums) %7B%0A        return null;%0A    %7D%0A    %0A    public static void main(String%5B%5D args
+import java.util.Arrays;%0Aimport java.util.Collections;%0Aimport java.util.HashSet;%0Aimport java.util.List;%0Aimport java.util.Set;%0Aimport java.util.stream.Collectors;%0A%0A/**%0A * https://leetcode.com/problems/subsets/%0A */%0Apublic class Problem78 %7B%0A    public List%3CList%3CInteger%3E%3E subsets(int%5B%5D nums) %7B%0A        List%3CList%3CInteger%3E%3E result = new ArrayList%3C%3E();%0A        List%3CInteger%3E numList = Arrays.stream(nums)%0A            .boxed()%0A            .collect(Collectors.toList());%0A        Collections.sort(numList);%0A        Set%3CList%3CInteger%3E%3E set = new HashSet%3C%3E();%0A        subsets(numList, set);%0A        result.addAll(set);%0A        result.add(numList);%0A        return result;%0A    %7D%0A    %0A    private void subsets(List%3CInteger%3E nums, Set%3CList%3CInteger%3E%3E set
 ) %7B%0A
@@ -791,43 +791,111 @@
     
+  
-  Problem78 prob = new Problem78();
+if (nums.size() == 0) %7B%0A            return;%0A        %7D%0A        for (int i = 0; i %3C nums.size(); i++) %7B
 %0A   
@@ -899,21 +899,20 @@
         
-for (
+    
 List%3CInt
@@ -921,98 +921,490 @@
 er%3E 
-list : prob.subsets(new int%5B%5D%7B1, 2, 3%7D)) %7B%0A            System.out.println(list);%0A        %7D
+newList = createList(nums, i);%0A            if (set.contains(newList)) %7B%0A                continue;%0A            %7D%0A            set.add(newList);%0A            subsets(newList, set);%0A        %7D%0A    %7D%0A    %0A    private List%3CInteger%3E createList(List%3CInteger%3E nums, int idx) %7B%0A        List%3CInteger%3E newList = new ArrayList%3C%3E();%0A        for (int i = 0; i %3C nums.size(); i++) %7B%0A            if (i != idx) %7B%0A                newList.add(nums.get(i));%0A            %7D%0A        %7D%0A        return newList;
 %0A   

Solve problem 78