Skip to content

Commit 02b610f

Browse files
committed
Update 1143-longest_common_subsequence.py
1 parent 68618a0 commit 02b610f

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

1143-longest_common_subsequence.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
"""
2-
https://leetcode.com/problems/longest-common-subsequence/solution/
2+
https://leetcode.com/problems/longest-common-subsequence/
33
44
Applications:
55
"Finding the longest common subsequence between two strings is useful for
@@ -43,7 +43,7 @@ def lcs(idx1, idx2):
4343
:type word2: str
4444
:rtype: int
4545
"""
46-
#base cases (empty string)
46+
#iterated through one (or both) of the string(s)
4747
if idx1 == len1 or idx2 == len2:
4848
return 0
4949

@@ -53,10 +53,10 @@ def lcs(idx1, idx2):
5353
#recursive cases
5454
answer = 0
5555
if text1[idx1] == text2[idx2]:
56-
#if the char matches
56+
#chars matches
5757
answer = 1 + lcs(idx1 + 1, idx2 + 1)
5858
else:
59-
#if the chars don't match
59+
#chars don't match, determine which string to move along on
6060
call1 = lcs(idx1 + 1, idx2)
6161
call2 = lcs(idx1, idx2 + 1)
6262
answer = max(call1, call2)

0 commit comments

Comments
 (0)