mirror of
https://github.com/youngyangyang04/leetcode-master.git
synced 2025-07-10 20:40:39 +08:00
Update
This commit is contained in:
@ -15,10 +15,12 @@ public:
|
||||
next[0] = -1;
|
||||
int j = -1;
|
||||
for(int i = 1; i < s.size(); i++){
|
||||
while(j >= 0 && s[i] != s[j+1])
|
||||
while (j >= 0 && s[i] != s[j + 1]) {
|
||||
j = next[j];
|
||||
if(s[i] == s[j+1])
|
||||
}
|
||||
if (s[i] == s[j + 1]) {
|
||||
j++;
|
||||
}
|
||||
next[i] = j;
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user