Skip to content

Commit d4151bd

Browse files
rwithikcclauss
authored andcommitted
Fix possible error in longest_common_subsequence.py (TheAlgorithms#1163)
The comparison at line 53 was not checking if (j > 0).
1 parent d327f10 commit d4151bd

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

dynamic_programming/longest_common_subsequence.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ def longest_common_subsequence(x: str, y: str):
5050

5151
seq = ""
5252
i, j = m, n
53-
while i > 0 and i > 0:
53+
while i > 0 and j > 0:
5454
if x[i - 1] == y[j - 1]:
5555
match = 1
5656
else:

0 commit comments

Comments
 (0)