Skip to content

Commit 83b0862

Browse files
authored
Update README.markdown
Here should be right. Bottom-left corner of the matrix is `matrix[0][m+1]`
1 parent 5beb84a commit 83b0862

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

Longest Common Subsequence/README.markdown

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ And so on... this is how `lcsLength(_:)` fills in the entire matrix.
9999

100100
## Backtracking to find the actual subsequence
101101

102-
So far we've calculated the length of every possible subsequence. The length of the longest subsequence is found in the bottom-left corner of matrix, at `matrix[n+1][m+1]`. In the above example it is 4, so the LCS consists of 4 characters.
102+
So far we've calculated the length of every possible subsequence. The length of the longest subsequence is found in the bottom-right corner of matrix, at `matrix[n+1][m+1]`. In the above example it is 4, so the LCS consists of 4 characters.
103103

104104
Having the length of every combination of substrings makes it possible to determine *which* characters are part of the LCS itself by using a backtracking strategy.
105105

0 commit comments

Comments
 (0)