Skip to content

Commit

Permalink
Update and rename 16. 3Sum Closest.cpp to 16. 3Sum Closest.md
Browse files Browse the repository at this point in the history
  • Loading branch information
keineahnung2345 authored Apr 18, 2022
1 parent aa96eda commit 29b424e
Showing 1 changed file with 15 additions and 5 deletions.
20 changes: 15 additions & 5 deletions 16. 3Sum Closest.cpp → 16. 3Sum Closest.md
Original file line number Diff line number Diff line change
@@ -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<int>& nums, int target) {
Expand Down Expand Up @@ -40,3 +49,4 @@ class Solution {
return ans;
}
};
```

0 comments on commit 29b424e

Please sign in to comment.