leetcode 16. 3Sum Closest (k-sum问题,two pointer)

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.

思路: 排序,然后two pointer,复杂度 O(n^2)

 

说点什么

您将是第一位评论人!

提醒
wpDiscuz