Back to course home
0% completed
Vote For New Content
Longest Common Subsequence
Problem Statement
Given two strings 's1' and 's2', find the length of the longest subsequence which is common in both the strings.
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.
Example 1:
Input: s1 = "abdca"
s2 = "cbda"
Output: 3
Explanation: The longest common subsequence is "bda".
Example 2:
Input: s1 = "passport"
s2 = "ppsspt"
Output: 5
Explanation: The longest common subsequence is "psspt".
Constraints:
- 1 <= s1.length, s2.length <= 1000`
s1
ands2
consist of only lowercase English characters.
Try it yourself
Try solving this question here:
Python3
Python3
. . . .
.....
.....
.....
Like the course? Get enrolled and start learning!
Table of Contents
Contents are not accessible
Contents are not accessible
Contents are not accessible
Contents are not accessible
Contents are not accessible