子集2 含有重复元素
2021-03-31 本文已影响0人
啊磊11
public static Listtask1(int[] nums){
back(nums,0,new ArrayList());
return result;
}
public static void back(int[] nums, int start, ArrayList path){
result.add(new ArrayList<>(path));
for(int i = start;i
if (i>start && nums[i]== nums[i-1] ){
continue;
}
path.add(nums[i]);
back(nums,i+1,path);
path.remove(path.size()-1);
}
}