You are given strings
Notes
A subsequence of a string
Constraints
and are strings consisting of lowercase English letters.
Input Specification
The first line of input will contain a string
The second line of input will contain a string
Output Specification
You are to print out, on a single line, one longest string that is a subsequence of both
Sample Input 1
Copy
axyb
abyxb
Sample Output 1
Copy
axb
The answer is axb
or ayb
; either one will be accepted.
Sample Input 2
Copy
aa
xayaz
Sample Output 2
Copy
aa
Sample Input 3
Copy
a
z
Sample Output 3
Copy
The answer is (an empty string).
Sample Input 4
Copy
abracadabra
avadakedavra
Sample Output 4
Copy
aaadara
Comments
Case 105 is a big bully
any advice of the last test case (105)? I got TLE on that one.
Any advice on how to not exceed memory? Do I have to do bottom-up?
You shouldn't store the string for each dp value
Thanks I got it. This should definitely be 10 points ¯\_(ツ)_/¯