Friday, March 11, 2011

Finding the Minimum Window in S which Contains All Elements from T

Source


Problem

Find the smallest window in a string containing all characters of another string

Given two strings string1 and string2, find the smallest substring in string1 containing all characters ofstring2 efficiently.

For Example:

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

Solution:

Best explained here

No comments:

Post a Comment