mirror of
https://github.com/TheAlgorithms/Python.git
synced 2025-07-05 09:21:13 +08:00
Make some ruff fixes (#8154)
* Make some ruff fixes * Undo manual fix * Undo manual fix * Updates from ruff=0.0.251
This commit is contained in:
@ -42,20 +42,14 @@ def longest_common_subsequence(x: str, y: str):
|
||||
|
||||
for i in range(1, m + 1):
|
||||
for j in range(1, n + 1):
|
||||
if x[i - 1] == y[j - 1]:
|
||||
match = 1
|
||||
else:
|
||||
match = 0
|
||||
match = 1 if x[i - 1] == y[j - 1] else 0
|
||||
|
||||
l[i][j] = max(l[i - 1][j], l[i][j - 1], l[i - 1][j - 1] + match)
|
||||
|
||||
seq = ""
|
||||
i, j = m, n
|
||||
while i > 0 and j > 0:
|
||||
if x[i - 1] == y[j - 1]:
|
||||
match = 1
|
||||
else:
|
||||
match = 0
|
||||
match = 1 if x[i - 1] == y[j - 1] else 0
|
||||
|
||||
if l[i][j] == l[i - 1][j - 1] + match:
|
||||
if match == 1:
|
||||
|
Reference in New Issue
Block a user