Message on Whatsapp 8879355057 for DSA(OA + Interview) + Fullstack Dev Training + 1-1 Personalized Mentoring to get 10+LPA Job
0 like 0 dislike
654 views
in Interview-Experiences by Expert (35,210 points) | 654 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 (35,210 points)

Get best answers to any doubt/query/question related to programming , jobs, gate, internships and tech-companies. Feel free to ask a question and you will receive the best advice/suggestion related to anything you ask about software-engineering , development and programming problems .