This commit is contained in:
youngyangyang04
2020-07-17 08:50:10 +08:00
parent b23016b284
commit e32c005967

View File

@ -4,11 +4,12 @@ https://leetcode-cn.com/problems/implement-strstr/
## 思路
KMP 经典算法
KMP的经典思想是:当出现字符串不匹配时,可以记录一部分之前已经匹配的文本内容,利用这些信息避免从头再去做匹配。
## C++代码
```
class Solution {
public:
void preKmp(int* next, const string& s){