mirror of
https://github.com/youngyangyang04/leetcode-master.git
synced 2025-07-08 08:50:15 +08:00
update 0015.三数之和:添加复杂度分析
This commit is contained in:
@ -83,6 +83,10 @@ public:
|
||||
};
|
||||
```
|
||||
|
||||
* 时间复杂度: O(n^2)
|
||||
* 空间复杂度: O(n),额外的 set 开销
|
||||
|
||||
|
||||
## 双指针
|
||||
|
||||
**其实这道题目使用哈希法并不十分合适**,因为在去重的操作中有很多细节需要注意,在面试中很难直接写出没有bug的代码。
|
||||
@ -158,6 +162,10 @@ public:
|
||||
};
|
||||
```
|
||||
|
||||
* 时间复杂度: O(n^2)
|
||||
* 空间复杂度: O(1)
|
||||
|
||||
|
||||
## 去重逻辑的思考
|
||||
|
||||
### a的去重
|
||||
|
Reference in New Issue
Block a user