Skip to content

Commit 015935e

Browse files
authored
update 0015.三数之和:添加复杂度分析
1 parent c91ee8f commit 015935e

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

problems/0015.三数之和.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,10 @@ public:
8383
};
8484
```
8585
86+
* 时间复杂度: O(n^2)
87+
* 空间复杂度: O(n),额外的 set 开销
88+
89+
8690
## 双指针
8791
8892
**其实这道题目使用哈希法并不十分合适**,因为在去重的操作中有很多细节需要注意,在面试中很难直接写出没有bug的代码。
@@ -158,6 +162,10 @@ public:
158162
};
159163
```
160164

165+
* 时间复杂度: O(n^2)
166+
* 空间复杂度: O(1)
167+
168+
161169
## 去重逻辑的思考
162170

163171
### a的去重

0 commit comments

Comments
 (0)