diff --git a/dynamic_programming/longest_common_subsequence.py b/dynamic_programming/longest_common_subsequence.py index 7447a0cc7..d39485408 100644 --- a/dynamic_programming/longest_common_subsequence.py +++ b/dynamic_programming/longest_common_subsequence.py @@ -50,7 +50,7 @@ def longest_common_subsequence(x: str, y: str): seq = "" i, j = m, n - while i > 0 and i > 0: + while i > 0 and j > 0: if x[i - 1] == y[j - 1]: match = 1 else: