Print Longest Common Subsequence | DP On Strings | DP Concepts & Qns-19
iPad PDF Notes - https://github.com/MAZHARMIK/Interview_DS_Algo/blob/master/iPad%20PDF%20Notes/DP%20Concepts%20%26%20Qns%20-%20Print%20LCS%20-%20Video%20-%2019.pdf
Whatsapp Community Link : https://www.whatsapp.com/channel/0029Va6kVSjICVfiVdsHgi1A
This is the 19th Video of our Playlist "DP Concepts & Qns".
From this video we have started "DP On Strings" and this is the first video of "DP On Strings" series in this playlist.
In this video we will try to solve a very good and famous DP problem : Print Longest Common Subsequence
Longest Common Subsequence - https://youtu.be/aJNu_DLyOxY?si=hENg3QjReCLLtbgA
I will explain the intuition so easily that you will never forget and start seeing this as cakewalk EASYYY.
We will do live coding after explanation and see if we are able to pass all the test cases.
Also, please note that my Github solution link below contains both C++ as well as JAVA code.
Problem Name : Print Longest Common Subsequence | DP On Strings | DP Concepts & Qns-19
Company Tags : Amazon Online Assessment
My solutions on Github(C++ & JAVA) : https://github.com/MAZHARMIK/Interview_DS_Algo/blob/master/DP/DP%20on%20Strings/Printing%20Longest%20Common%20Subsequence.cpp
Leetcode Link : https://www.geeksforgeeks.org/printing-longest-common-subsequence/ (You can print and check your LCS in this leetcode problem)
My DP Concepts Playlist : https://youtu.be/7eLMOE1jnls
My Graph Concepts Playlist : https://youtu.be/5JGiZnr6B5w
My Recursion Concepts Playlist : https://www.youtube.com/watch?v=pfb1Zduesi8&list=PLpIkg8OmuX-IBcXsfITH5ql0Lqci1MYPM
My GitHub Repo for interview preparation : https://github.com/MAZHARMIK/Interview_DS_Algo
Instagram : https://www.instagram.com/codestorywithmik/
Facebook : https://www.facebook.com/people/codestorywithmik/100090524295846/
Twitter : https://twitter.com/CSwithMIK
Subscribe to my channel : https://www.youtube.com/@codestorywithMIK
Approach Summary :
The provided code has printLongestCommonSubsequence function that takes two strings, s1 and s2, as input. The method uses dynamic programming to find and print the Longest Common Subsequence (LCS) of the given strings. It initializes a 2D vector t to store the length of LCS for each pair of substrings. It then populates the vector using a bottom-up approach and retrieves the LCS by backtracking through the filled matrix. Finally, the LCS is printed to the console. The code utilizes the standard library's vector and string classes.
╔═╦╗╔╦╗╔═╦═╦╦╦╦╗╔═╗
║╚╣║║║╚╣╚╣╔╣╔╣║╚╣═╣
╠╗║╚╝║║╠╗║╚╣║║║║║═╣
╚═╩══╩═╩═╩═╩╝╚╩═╩═╝
✨ Timelines✨
00:00 - Introduction
00:10 - Motivation
00:29 - What have we done till now ?
00:55 - List of Problems - DP on Strings
02:32 - Recalling LCS
15:26 - Finding LCS String
24:14 - Story To Code
28:15 - Coding it up
32:27 - Time & Space Complexity
#coding #helpajobseeker #easyrecipes #leetcode #leetcodequestionandanswers #leetcodesolution #leetcodedailychallenge #leetcodequestions #leetcodechallenge #hindi #india #coding #helpajobseeker #easyrecipes #leetcode #leetcodequestionandanswers #leetcodesolution #leetcodedailychallenge#leetcodequestions #leetcodechallenge #hindi #india #hindiexplanation #hindiexplained #easyexplaination #interview#interviewtips #interviewpreparation #interview_ds_algo #hinglish #github #design #data #google #video #instagram #facebook #leetcode #computerscience #leetcodesolutions #leetcodequestionandanswers #code #learning #dsalgo #dsa #newyear2024