How to find smallest substring which contains all characters from a given string?

Posted by Rajendra on Stack Overflow See other posts from Stack Overflow or by Rajendra
Published on 2010-03-17T03:00:38Z Indexed on 2010/03/17 3:01 UTC
Read the original article Hit count: 209

I have recently come across an interesting question on strings. Suppose you are given following:

Input string1: "this is a test string"
Input string2: "tist"
Output string: "t stri"

So, given above, how can I approach towards finding smallest substring of string1 that contains all the characters from string 2?

© Stack Overflow or respective owner

Related posts about string-manipulation

Related posts about interview-questions