diff --git a/16. 3Sum Closest.cpp b/16. 3Sum Closest.md similarity index 73% rename from 16. 3Sum Closest.cpp rename to 16. 3Sum Closest.md index 4ad793d..6927a62 100644 --- a/16. 3Sum Closest.cpp +++ b/16. 3Sum Closest.md @@ -1,8 +1,17 @@ -//Two pointer -//https://leetcode.com/problems/3sum-closest/discuss/8026/Python-solution-(two-pointer). -//Runtime: 8 ms, faster than 81.20% of C++ online submissions for 3Sum Closest. -//Memory Usage: 8.2 MB, less than 100.00% of C++ online submissions for 3Sum Closest. -//time: O(nlogn + n^2) +# 16. 3Sum Closest + +[leetcode - 16. 3Sum Closest](https://leetcode.com/problems/3sum-closest/) + +## Two pointer +https://leetcode.com/problems/3sum-closest/discuss/8026/Python-solution-(two-pointer). + +Runtime: 8 ms, faster than 81.20% of C++ online submissions for 3Sum Closest. + +Memory Usage: 8.2 MB, less than 100.00% of C++ online submissions for 3Sum Closest. + +time: O(nlogn + n^2) + +```cpp class Solution { public: int threeSumClosest(vector& nums, int target) { @@ -40,3 +49,4 @@ class Solution { return ans; } }; +```