Рет қаралды 192,988
Code & Problem Statement @ backtobackswe.com/platform/content/longest-common-subsequence/video?
Free 5-Day Mini-Course: backtobackswe.com
Try Our Full Platform: 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: kzfaq.info/love/Of7UPMHBjAavgD0Qw5q5ww
Tuschar Roy: kzfaq.info
GeeksForGeeks: kzfaq.info/love/0RhatS1pyxInC00YKjjBqQ
Jarvis Johnson: kzfaq.info
Success In Tech: kzfaq.info/love/-vYrOAmtrx9sBzJAf3x_xw