Minimum Window Substring

Hard

Question

Return the shortest substring of input that has all the characters given in match.

If there are no matches, then return an empty string.

Input: input = "acabaa", match = "bc"

Output: "cab"

Input: input = "aabbccddee", match = "abcab"

Output: "aabbc"

Input: input = "abc", match = "dab"

Output: ""

There is no substring that has all the characters in match.

Clarify the problem

What are some questions you'd ask an interviewer?

Understand the problem

What is the shortest substring of "catmagicmcdog" that contains all the characters in "mac"?
3
4
5
6

Login or signup to save your code.

Notes