78. Subsets
class Solution { public List<List<Integer>> subsets(int[] nums) { List<List<Integer>> res=new ArrayList<List<Integer>>(); subsets(0, new ArrayList<Integer>(), res, nums); return res; } private void subsets(int idx, List<Integer> list, List<List<Integer>> res, int[] nums){ if(idx==nums.length) { res.add(new ArrayList<Integer>(list)); return; } subsets(idx+1, list, res, nums); list.add(nums[idx]); subsets(idx+1, list, res, nums); list.remove(list.size()-1); } }