diff options
| author | mzuenni <michi.zuendorf@gmail.com> | 2024-02-03 14:33:16 +0100 |
|---|---|---|
| committer | mzuenni <michi.zuendorf@gmail.com> | 2024-02-03 14:33:16 +0100 |
| commit | 631335a9c1dd0fba0e17977253d0a4b033aee59a (patch) | |
| tree | 9579d774a927b899f447cb6854d3d4b28f53b5f4 /string | |
| parent | 155e414b2252a491c626d3382b6a89b13ec3b10d (diff) | |
fix indent
Diffstat (limited to 'string')
| -rw-r--r-- | string/z.cpp | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/string/z.cpp b/string/z.cpp index c128e9d..069fa38 100644 --- a/string/z.cpp +++ b/string/z.cpp @@ -1,10 +1,10 @@ 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; + 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; } |
