Skip to content

#1143 - Longest Common Subsequence

MediumDP - Multidimensional
Open on LeetCode

Given two strings text1 and text2, return the length of their longest common subsequence (LCS). A subsequence is derived by deleting some (or no) characters without changing the order.

InputOutput
text1 = "abcde", text2 = "ace"3 (LCS = "ace")
text1 = "abc", text2 = "abc"3
text1 = "abc", text2 = "def"0

Released under the MIT License.