← All problems
Longest Common Subsequence
Given two strings, find the length of their longest common subsequence — the longest sequence that appears as a subsequence (not necessarily contiguous) in both strings.
Complexity
Time O(mn), Space O(mn)
Common pitfalls
- Confusing subsequence with substring
- Off-by-one in table indexing
Your solution
Log in to save your code and track progress.