mirror of
https://github.com/youngyangyang04/leetcode-master.git
synced 2025-07-07 15:45:40 +08:00
Update
This commit is contained in:
@ -4,11 +4,12 @@ https://leetcode-cn.com/problems/implement-strstr/
|
|||||||
|
|
||||||
## 思路
|
## 思路
|
||||||
|
|
||||||
|
KMP 经典算法
|
||||||
|
KMP的经典思想是:当出现字符串不匹配时,可以记录一部分之前已经匹配的文本内容,利用这些信息避免从头再去做匹配。
|
||||||
|
|
||||||
## C++代码
|
## C++代码
|
||||||
|
|
||||||
```
|
```
|
||||||
|
|
||||||
class Solution {
|
class Solution {
|
||||||
public:
|
public:
|
||||||
void preKmp(int* next, const string& s){
|
void preKmp(int* next, const string& s){
|
||||||
|
Reference in New Issue
Block a user