• Tutorials
  • DSA
  • Data Science
  • Web Tech
  • Courses
August 11, 2023 |930 Views

Longest Common Subsequence

Description
Discussion

This video is part of the Dynamic Programming section in the GFG SDE Sheet. In this video, we are given two strings. Our task is to find the length of the longest subsequence present in both of them. 

Example :

Input:
A = 6, B = 6
str1 = ABCDGH
str2 = AEDFHR

Output: 3

Explanation: LCS for input strings “ABCDGH” and “AEDFHR” is “ADH” of length 3. 

Try it out before watching the implementation of the problem in the video. We recommend watching the video, even if you can solve the problem. You may discover something new. All the best!!!

Do check out:-

Article: https://www.geeksforgeeks.org/longest-common-subsequence-dp-4/
Problem: https://practice.geeksforgeeks.org/problems/longest-common-subsequence-1587115620/1
SDE Sheet: https://www.geeksforgeeks.org/sde-sheet-a-complete-guide-for-sde-preparation/