Skip to content

Commit 0094577

Browse files
[pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
1 parent 1e8f767 commit 0094577

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

divide_and_conquer/Suffix Array and LCP implementation.py

+5-2
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,9 @@ def build_lcp_array(self) -> List[int]:
4747
for i in range(n):
4848
if rank[i] > 0:
4949
j = suffix_array[rank[i] - 1]
50-
while (i + h < n) and (j + h < n) and self.text[i + h] == self.text[j + h]:
50+
while (
51+
(i + h < n) and (j + h < n) and self.text[i + h] == self.text[j + h]
52+
):
5153
h += 1
5254
lcp[rank[i]] = h
5355
if h > 0:
@@ -83,7 +85,8 @@ def display(self) -> None:
8385
print("\nLCP Array:")
8486
for i in range(1, len(self.lcp_array)):
8587
print(
86-
f"LCP between {self.text[self.suffix_array[i - 1]:]} and {self.text[self.suffix_array[i]:]}: {self.lcp_array[i]}")
88+
f"LCP between {self.text[self.suffix_array[i - 1]:]} and {self.text[self.suffix_array[i]:]}: {self.lcp_array[i]}"
89+
)
8790

8891

8992
# Example usage:

0 commit comments

Comments
 (0)