diff options
Diffstat (limited to 'string/z.cpp')
| -rw-r--r-- | string/z.cpp | 10 |
1 files changed, 0 insertions, 10 deletions
diff --git a/string/z.cpp b/string/z.cpp deleted file mode 100644 index 069fa38..0000000 --- a/string/z.cpp +++ /dev/null @@ -1,10 +0,0 @@ -vector<int> Z(const string& s) { - int n = sz(s); - vector<int> z(n); - for (int i = 1, x = 0; i < n; i++) { - z[i] = max(0, min(z[i - x], x + z[x] - i)); - while (i + z[i] < n && s[z[i]] == s[i + z[i]]) { - x = i, z[i]++; - }} - return z; -} |
