We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 167cb84 commit dbcd875Copy full SHA for dbcd875
problems/0459.重复的子字符串.md
@@ -73,6 +73,8 @@ public:
73
}
74
};
75
```
76
+* 时间复杂度: O(n)
77
+* 空间复杂度: O(1)
78
79
不过这种解法还有一个问题,就是 我们最终还是要判断 一个字符串(s + s)是否出现过 s 的过程,大家可能直接用contains,find 之类的库函数。 却忽略了实现这些函数的时间复杂度(暴力解法是m * n,一般库函数实现为 O(m + n))。
80
@@ -185,6 +187,8 @@ public:
185
187
186
188
189
190
191
+* 空间复杂度: O(n)
192
193
194
前缀表(不减一)的C++代码实现:
@@ -219,6 +223,8 @@ public:
219
223
220
224
221
225
226
227
222
228
229
230
## 其他语言版本
0 commit comments