Longest Common Subsequence (2 Strings) - Dynamic Programming & Competing Subproblems

Описание к видео Longest Common Subsequence (2 Strings) - Dynamic Programming & Competing Subproblems

Code & Problem Statement @ https://backtobackswe.com/platform/co...

Free 5-Day Mini-Course: https://backtobackswe.com
Try Our Full Platform: https://backtobackswe.com/pricing
📹 Intuitive Video Explanations
🏃 Run Code As You Learn
💾 Save Progress
❓New Unseen Questions
🔎 Get All Solutions


Question: You are given 2 strings. Return the length of the longest subsequence that the 2 strings share.

Complexities

n = s1.length()
m = s2.length()

Time: O( nm )

We can upper bound time by the number of subproblems that we are going to solve.

Space: O( nm )

We upper bound space by the number of subproblems we will story answers to. Whether we do (n + 1)(m + 1) or (n)(m) doesn't matter asymptotically.


++++++++++++++++++++++++++++++++++++++++++++++++++

HackerRank:    / @hackerrankofficial  

Tuschar Roy:    / tusharroy2525  

GeeksForGeeks:    / @geeksforgeeksvideos  

Jarvis Johnson:    / vsympathyv  

Success In Tech:    / @successintech  

Комментарии

Информация по комментариям в разработке