Dashboard
LC #1143
Longest Common Subsequence
Pattern · ?AmazonGoogleMetaBloombergMicrosoft
Problem
Find the length of the longest subsequence common to two strings.
Constraints
- 1 ≤ text1.length, text2.length ≤ 1000
- Lowercase English letters only
Example
- Input
- text1 = "abcde", text2 = "ace"
- Output
- 3
- Why
- LCS is "ace" (length 3). A subsequence need not be contiguous
Spot the pattern
Which pattern cracks it?
Hints
One at a time