3Sum Closest

问题描述:

Given an array S of n integers, find three integers in S such that the sum is closest to a given number, target. Return the sum of the three integers. You may assume that each input would have exactly one solution.

题解:

3Sum思路一样,先排序,然后左右夹逼,复杂度O(n*n)。

练一练:

3Sum Closest

0 Likes

你目前的身份是游客,评论请输入昵称和电邮!