Accepted leetcode solution for the same


#1

public List<List> subsets(int[] nums) {
List<List> result = new ArrayList<List>();
List original = new ArrayList();
result.add(original);

for (int i = 0 ; i < nums.length; i++){
  List<ArrayList<Integer>> temp = new ArrayList<ArrayList<Integer>>();
  int item = nums[i];
  for (int j = 0; j < result.size(); j++){
    List<Integer> res = result.get(j);
    ArrayList<Integer> newone = new ArrayList<Integer>();
    newone.addAll(res);
    newone.add(item);
    temp.add(newone);
  }
  result.addAll(temp);
}
return result;
}