We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent c802884 commit 4ae7614Copy full SHA for 4ae7614
strings/z_function.py
@@ -26,9 +26,7 @@ def z_function(input_str: str) -> list:
26
[0, 3, 2, 1]
27
>>> z_function("zxxzxxz")
28
[0, 0, 0, 4, 0, 0, 1]
29
-
30
"""
31
32
z_result = [0] * len(input_str)
33
34
# initialize interval's left pointer and right pointer
@@ -53,8 +51,7 @@ def z_function(input_str: str) -> list:
53
51
54
52
def go_next(i, z_result, s):
55
56
- Helping function, which checks if we have to
57
- move forward to the next characters or not
+ Check if we have to move forward to the next characters or not
58
59
return i + z_result[i] < len(s) and s[z_result[i]] == s[i + z_result[i]]
60
0 commit comments