Find the shortest contiguous substring of a sentence containing all words of another string.
Unlock detailed company stats for this questionUpgrade
Given S1, a sentence, and S2, a string containing words, find the shortest contiguous substring of S1 that contains all the words in S2 (assume all S2 words appear in S1). Example: S1 = "this is a test string for test purposes", S2 = "test string purposes" gives "string for test purposes".
Community answers
No answers contributed by the community yet.
Related questions
Find the smallest substring containing all characters of another string.Find the minimum contiguous window of words containing all required words.Find the shortest subsequence of a cyclic string S that contains all characters of a pattern k.Related courses

Course

Course
Course
