Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit f861680

Browse files
author
Oleksandr Kulkov
authored
fix rendering errors
1 parent c8330dc commit f861680

File tree

1 file changed

+17
-9
lines changed

1 file changed

+17
-9
lines changed

src/string/main_lorentz.md

Lines changed: 17 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -120,18 +120,24 @@ Let us generate **necessary and sufficient** conditions for such a repetition at
120120

121121
- Let $k_1$ be the largest number such that the first $k_1$ characters before the position $cntr$ coincide with the last $k_1$ characters in the string $u$:
122122

123-
\[u[cntr - k_1 \dots cntr - 1] = u[|u| - k_1 \dots |u| - 1]\]
123+
$$
124+
u[cntr - k_1 \dots cntr - 1] = u[|u| - k_1 \dots |u| - 1]
125+
$$
124126

125127
- Let $k_2$ be the largest number such that the $k_2$ characters starting at position $cntr$ coincide with the first $k_2$ characters in the string $v$:
126-
127-
\[u[cntr \dots cntr + k_2 - 1] = v[0 \dots k_2 - 1]\]
128+
129+
$$
130+
u[cntr \dots cntr + k_2 - 1] = v[0 \dots k_2 - 1]
131+
$$
128132

129133
- Then we have a repetition exactly for any pair $(l_1,~ l_2)$ with
130-
131-
\[\begin{align}
134+
135+
$$
136+
\begin{align}
132137
l_1 &\le k_1, \\\\
133138
l_2 &\le k_2. \\\\
134-
\end{align}\]
139+
\end{align}
140+
$$
135141

136142
To summarize:
137143

@@ -140,12 +146,14 @@ To summarize:
140146
There might be multiple such repetitions, they depend on the lengths $l_1$ and $l_2 = l - l_1$.
141147
- We find $k_1$ and $k_2$ as described above.
142148
- Then all suitable repetitions are the ones for which the lengths of the pieces $l_1$ and $l_2$ satisfy the conditions:
143-
144-
\[\begin{align}
149+
150+
$$
151+
\begin{align}
145152
l_1 + l_2 &= l = |u| - cntr \\\\
146153
l_1 &\le k_1, \\\\
147154
l_2 &\le k_2. \\\\
148-
\end{align}\]
155+
\end{align}
156+
$$
149157

150158
Therefore the only remaining part is how we can compute the values $k_1$ and $k_2$ quickly for every position $cntr$.
151159
Luckily we can compute them in $O(1)$ using the [Z-function](../string/z-function.md):

0 commit comments

Comments
 (0)