mirror of
https://github.com/TheAlgorithms/Python.git
synced 2025-04-16 10:47:37 +00:00
Fix possible error in longest_common_subsequence.py (#1163)
The comparison at line 53 was not checking if (j > 0).
This commit is contained in:
parent
d327f10702
commit
d4151bd516
@ -50,7 +50,7 @@ def longest_common_subsequence(x: str, y: str):
|
|||||||
|
|
||||||
seq = ""
|
seq = ""
|
||||||
i, j = m, n
|
i, j = m, n
|
||||||
while i > 0 and i > 0:
|
while i > 0 and j > 0:
|
||||||
if x[i - 1] == y[j - 1]:
|
if x[i - 1] == y[j - 1]:
|
||||||
match = 1
|
match = 1
|
||||||
else:
|
else:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user