摘要:
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(... 阅读全文