Skip to content

Latest commit

 

History

History
15 lines (11 loc) · 580 Bytes

File metadata and controls

15 lines (11 loc) · 580 Bytes

Problem 4: The Longest Common Thread (Longest Common Subsequence)

Problem Statement

Given two strings text1 and text2, return the length of their longest common subsequence. A subsequence is a sequence that can be derived from another sequence by deleting some or no elements without changing the order of the remaining elements.

Input Format

  • Two strings text1 and text2.

Constraints

  • 1 <= text1.length, text2.length <= 1000

Example

Input: text1 = "abcde", text2 = "ace"
Output: 3
Explanation: The longest common subsequence is "ace".