Minimum Window Substring

STRING
HASH TABLE

Problem

Given two strings s and t, return the minimum window in s which will contain all the characters in t. If there is no such window in s that covers all characters in t, return an empty string.

If there are multiple such windows, return the one that appears first. If there are multiple windows of the same length, return any one of them.

Examples

minWindowSubstring("aDObEcbgaNc", "ab") // returns "bga" // "bga" is the smallest substring of s // that contains all the characters in t. minWindowSubstring("A", "A") // returns "A" minWindowSubstring("A", "B") // returns ""
Loading...