Sliding WindowHard

Minimum Window Substring

Return the shortest contiguous part of s that contains every character of t (repeats included). If none exists, return "". When there is a tie, return the one that starts first.

Example 1s = "ZXAYBCQABC", t = "ABC" → "ABC"
Example 2s = "a", t = "aa" → ""s has only one a.
1 ≤ lengths ≤ 10⁵ · upper and lower case letters

Hints

0 of 3 open
Hint 2 · the patternHint 3 · the key line