update 0015.三数之和:添加复杂度分析

This commit is contained in:
Yuhao Ju
2023-03-19 11:24:04 +08:00
committed by GitHub
parent c91ee8fdc2
commit 015935e4fa

View File

@ -83,6 +83,10 @@ public:
};
```
* 时间复杂度: O(n^2)
* 空间复杂度: O(n),额外的 set 开销
## 双指针
**其实这道题目使用哈希法并不十分合适**因为在去重的操作中有很多细节需要注意在面试中很难直接写出没有bug的代码。
@ -158,6 +162,10 @@ public:
};
```
* 时间复杂度: O(n^2)
* 空间复杂度: O(1)
## 去重逻辑的思考
### a的去重