44. DP on strings
1. LCS-⭐ we will find answer through the way of generating all subsequences ------------ 1. Express everything in terms of indices 2. Explore all possibilities on that indices 3. take the best among them ---------- ------------------ a) Recursion Approach- 1. if char at i & j matches => do 1+f(i-1,j-1) 2. if char at i & j do not matches => do f(i-1,j) + f(i,j-1) => explore both possibilities by moving 1 ptr at a time ---------------- b) Memoization ✅ -------------------- c) Tabulation - since we can't write base case of recursion into tabulation with negative indices so we do a shifting of indices to right by 1 which means now f(i,j) will mean we want LCS of str1 till i-1 with str2 till j-1 we can also space optimize this solution using curr & prev vectors -------------------------------------------------------------------------------------------------------------------------- 2. Print LCS we will backtrack over dp table below is table we got...