Trusted answers to developer questions
Trusted Answers to Developer Questions

Related Tags

What is the Longest Common Subsequence Problem?

Educative Answers Team

Grokking Modern System Design Interview for Engineers & Managers

Ace your System Design Interview and take your career to the next level. Learn to handle the design of applications like Netflix, Quora, Facebook, Uber, and many more in a 45-min interview. Learn the RESHADED framework for architecting web-scale applications by determining requirements, constraints, and assumptions before diving into a step-by-step design process.

The Longest Common Subsequence Problem is one of the most famous problems in Dynamic Programming.

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.

A longest subsequence of string s1 and s2 is the length of the longest subsequence which is common in both the strings.

Let’s look at an example to illustrate the concept: Given two strings as input:

s1= "abdca"
s2= "cbda"
Output: 3