Skip to content

Commit 9b5b565

Browse files
committed
fix: changed variable names to lowercase as per ruff style guide
1 parent 9fa8a3f commit 9b5b565

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

strings/longest_common_subsequence.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,14 @@
33
# using Dynamic Programming and also prints the actual LCS string.
44

55

6-
def longest_common_subsequence(X: str, Y: str):
7-
m, n = len(X), len(Y)
6+
def longest_common_subsequence(x: str, y: str):
7+
m, n = len(x), len(y)
88
dp = [[0] * (n + 1) for _ in range(m + 1)]
99

1010
# Fill the dp table
1111
for i in range(1, m + 1):
1212
for j in range(1, n + 1):
13-
if X[i - 1] == Y[j - 1]:
13+
if x[i - 1] == y[j - 1]:
1414
dp[i][j] = 1 + dp[i - 1][j - 1]
1515
else:
1616
dp[i][j] = max(dp[i - 1][j], dp[i][j - 1])
@@ -19,8 +19,8 @@ def longest_common_subsequence(X: str, Y: str):
1919
i, j = m, n
2020
lcs = []
2121
while i > 0 and j > 0:
22-
if X[i - 1] == Y[j - 1]:
23-
lcs.append(X[i - 1])
22+
if x[i - 1] == y[j - 1]:
23+
lcs.append(x[i - 1])
2424
i -= 1
2525
j -= 1
2626
elif dp[i - 1][j] > dp[i][j - 1]:

0 commit comments

Comments
 (0)