medium
Longest Common Subsequence
Given two strings, return the length of the longest sequence of characters that appears in both strings in the same relative order (not necessarily contiguously).
Constraints
- 1 ≤ text1.length, text2.length ≤ 1000
- Lowercase English letters
Examples
in: text1 = "abcde", text2 = "ace"
out: 3
Code it yourself
Solve in
Test execution is not yet available for this exercise.Practice journal →Draft saved in this browser.
Hints:
Which approach applies?
Choose an approach to check your pattern recognition, or reveal the discussion when you need help.