Skip to content

Commit 6a6cf83

Browse files
authored
Merge pull request #711 from KeithMorning/orign_master
Fix typo: bottom-left -> bottom-right
2 parents b83ef3b + 087daa9 commit 6a6cf83

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

Longest Common Subsequence/README.markdown

+1-1
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,7 @@ func backtrack(_ matrix: [[Int]]) -> String {
156156
}
157157
```
158158

159-
This backtracks from `matrix[n+1][m+1]` (bottom-right corner) to `matrix[1][1]` (top-right corner), looking for characters that are common to both strings. It adds those characters to a new string, `lcs`.
159+
This backtracks from `matrix[n+1][m+1]` (bottom-right corner) to `matrix[1][1]` (top-left corner), looking for characters that are common to both strings. It adds those characters to a new string, `lcs`.
160160

161161
The `charInSequence` variable is an index into the string given by `self`. Initially this points to the last character of the string. Each time we decrement `i`, we also move back `charInSequence`. When the two characters are found to be equal, we add the character at `self[charInSequence]` to the new `lcs` string. (We can't just write `self[i]` because `i` may not map to the current position inside the Swift string.)
162162

0 commit comments

Comments
 (0)