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);
}
}
网友评论