Google | Phone Screen | Find shortest substring which contains all the alphabets of another String
Anonymous User
6951

I recently had an interview with Google and i was asked this question.

Given a string S and a string t , find the minimum window substring in S which contains all the characters of the string T in the same order.

Input :
S : abbcabbacc
T : abc

Output :
abbc - length=4

output would be 4 as that's the minimum length substring which contains all the characters of T in order.

Is there a stack solution feasible here where we check from the end of the string S .

Comments (9)