mirror of
https://github.com/TheAlgorithms/Python.git
synced 2025-07-05 01:09:40 +08:00
Add pep8-naming to pre-commit hooks and fixes incorrect naming conventions (#7062)
* ci(pre-commit): Add pep8-naming to `pre-commit` hooks (#7038) * refactor: Fix naming conventions (#7038) * Update arithmetic_analysis/lu_decomposition.py Co-authored-by: Christian Clauss <cclauss@me.com> * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * refactor(lu_decomposition): Replace `NDArray` with `ArrayLike` (#7038) * chore: Fix naming conventions in doctests (#7038) * fix: Temporarily disable project euler problem 104 (#7069) * chore: Fix naming conventions in doctests (#7038) Co-authored-by: Christian Clauss <cclauss@me.com> Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
This commit is contained in:
@ -38,7 +38,7 @@ def longest_common_subsequence(x: str, y: str):
|
||||
n = len(y)
|
||||
|
||||
# declaring the array for storing the dp values
|
||||
L = [[0] * (n + 1) for _ in range(m + 1)]
|
||||
l = [[0] * (n + 1) for _ in range(m + 1)] # noqa: E741
|
||||
|
||||
for i in range(1, m + 1):
|
||||
for j in range(1, n + 1):
|
||||
@ -47,7 +47,7 @@ def longest_common_subsequence(x: str, y: str):
|
||||
else:
|
||||
match = 0
|
||||
|
||||
L[i][j] = max(L[i - 1][j], L[i][j - 1], L[i - 1][j - 1] + match)
|
||||
l[i][j] = max(l[i - 1][j], l[i][j - 1], l[i - 1][j - 1] + match)
|
||||
|
||||
seq = ""
|
||||
i, j = m, n
|
||||
@ -57,17 +57,17 @@ def longest_common_subsequence(x: str, y: str):
|
||||
else:
|
||||
match = 0
|
||||
|
||||
if L[i][j] == L[i - 1][j - 1] + match:
|
||||
if l[i][j] == l[i - 1][j - 1] + match:
|
||||
if match == 1:
|
||||
seq = x[i - 1] + seq
|
||||
i -= 1
|
||||
j -= 1
|
||||
elif L[i][j] == L[i - 1][j]:
|
||||
elif l[i][j] == l[i - 1][j]:
|
||||
i -= 1
|
||||
else:
|
||||
j -= 1
|
||||
|
||||
return L[m][n], seq
|
||||
return l[m][n], seq
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
|
Reference in New Issue
Block a user