classSolution:""" @param numbers: Give an array numbers of n integer @param target : An integer @return : return the sum of the three integers, the sum closest target. """defthreeSumClosest(self,numbers,target):# write your code hereifnumbers==Noneorlen(numbers)==0:return0diff=sys.maxintresult=0sorted_array=sorted(numbers)foriinrange(len(numbers)):j=i+1k=len(numbers)-1whilej<k:tmp_sum=sorted_array[i]+sorted_array[j]+sorted_array[k]ifabs(tmp_sum-target)<diff:diff=abs(tmp_sum-target)result=tmp_sumiftmp_sum==target:returnresulteliftmp_sum>target:k-=1else:j+=1returnresult