|
1 | | -# 15. 3Sum - Best Practices of LeetCode Solutions |
2 | | -LeetCode link: [15. 3Sum](https://leetcode.com/problems/3sum), difficulty: **Medium** |
| 1 | +Original link: [leetcoder.net - LeetCoder: Fucking Good LeetCode Solutions](https://leetcoder.net/en/leetcode/15-3sum) |
| 2 | + |
| 3 | +# 15. 3Sum - LeetCoder: Fucking Good LeetCode Solutions |
| 4 | +LeetCode link: [15. 3Sum](https://leetcode.com/problems/3sum), Difficulty: **Medium**. |
3 | 5 |
|
4 | 6 | ## LeetCode description of "15. 3Sum" |
5 | 7 | Given an integer array nums, return all the triplets `[nums[i], nums[j], nums[k]]` such that `i != j`, `i != k`, and `j != k`, and `nums[i] + nums[j] + nums[k] == 0`. |
@@ -85,8 +87,8 @@ Notice that the order of the output and the order of the triplets does not matte |
85 | 87 | ``` |
86 | 88 |
|
87 | 89 | ## Complexity |
88 | | -* Time: `O(N * N)`. |
89 | | -* Space: `O(N)`. |
| 90 | +- Time complexity: `O(N * N)`. |
| 91 | +- Space complexity: `O(N)`. |
90 | 92 |
|
91 | 93 | ## Python |
92 | 94 | ### Solution 1: Use Map (complex and slow) |
@@ -164,37 +166,7 @@ class Solution: |
164 | 166 | return list(results) |
165 | 167 | ``` |
166 | 168 |
|
167 | | -## C++ |
168 | | -```cpp |
169 | | -// Welcome to create a PR to complete the code of this language, thanks! |
170 | | -``` |
171 | | - |
172 | | -## Java |
| 169 | +## Other languages |
173 | 170 | ```java |
174 | 171 | // Welcome to create a PR to complete the code of this language, thanks! |
175 | 172 | ``` |
176 | | - |
177 | | -## JavaScript |
178 | | -```javascript |
179 | | -// Welcome to create a PR to complete the code of this language, thanks! |
180 | | -``` |
181 | | - |
182 | | -## C# |
183 | | -```c# |
184 | | -// Welcome to create a PR to complete the code of this language, thanks! |
185 | | -``` |
186 | | - |
187 | | -## Go |
188 | | -```go |
189 | | -// Welcome to create a PR to complete the code of this language, thanks! |
190 | | -``` |
191 | | - |
192 | | -## Ruby |
193 | | -```ruby |
194 | | -# Welcome to create a PR to complete the code of this language, thanks! |
195 | | -``` |
196 | | - |
197 | | -## C, Kotlin, Swift, Rust or other languages |
198 | | -``` |
199 | | -// Welcome to create a PR to complete the code of this language, thanks! |
200 | | -``` |
0 commit comments