Message on Whatsapp 8879355057 for DSA(OA + Interview) + Fullstack Dev Training + 1-1 Personalized Mentoring to get 10+LPA Job
0 like 0 dislike
717 views
in Interview-Experiences by Expert (34,270 points) | 717 views

1 Answer

0 like 0 dislike
Question : Given two strings S1 and S2, find the number of times S1 needs to append to itself such that S2 is subsequence of S1. S1 and S2 contain only lowercase english alphabets
Testcase :
I/p : S1 = time , S2 = meit
O/p : 2 i.e., meit is subsequence of timetimetime

 

Expected solution along with Hint : 2-D Dp solution with Time and Space is O(26*n)
by Expert (34,270 points)