Skip to content

Commit 2bb8da3

Browse files
rwithikstokhos
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 17ffd99 commit 2bb8da3

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

Diff for: 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)