Problems / Longest Common Subsequence
Medium

Longest Common Subsequence

Medium 72 submissions 25 coins +100 XP
Dynamic Programming String
Problem Description
Return the length of the longest subsequence shared by `text1` and `text2` (characters in order, not necessarily contiguous). Return `0` if there is none. **Example 1:** ``` Input: text1 = "abcde", text2 = "ace" Output: 3 ``` **Example 2:** ``` Input: text1 = "abc", text2 = "abc" Output: 3 ``` **Example 3:** ``` Input: text1 = "abc", text2 = "def" Output: 0 ```
Constraints
- `1 <= text1.length, text2.length <= 1000` - Lowercase English letters only.

Need help?

Connect with expert programmers for real-time collaborative coding, video meetings, and whiteboard sessions via CodeConnect.

Video Call Whiteboard Live Coding Screen Share