摘要: Analysis:1. Sort the vector;2. Set i, j, k and traverse;3. Start from i, j is after i, and k is the last element;4. If theTrick: By increasing j and decreasing k, to reduce the complexity from n^3 to n^2.class Solution {public: int threeSumClosest(vector &num, int target) { sort(num.begin(... 阅读全文
posted @ 2013-10-21 10:51 WinsCoder 阅读(127) 评论(0) 推荐(0) 编辑