Back to DSA sheet

Longest Common Subsequence

MediumDynamic Programming
Open on LeetCodeAmazonGoogleMicrosoft

Return the length of the longest subsequence common to two strings.

Constraints
  • 1 <= text1.length, text2.length <= 1000
Sheets
Blind 75Grind 75NeetCode 150NeetCode 250
longest-common-subsequence.cpp
Loading editor
Custom input (stdin)
Output

Run your code to see its output.