19. Minimum Window Substring

Return the shortest substring of s that contains every character of t (including duplicates). If there is none, return "". The answer is unique when it exists.

Example 1

Input: s = "ADOBECODEBANC", t = "ABC"
Output: "BANC"
Explanation: “BANC” is the shortest window containing A, B and C.

Example 2

Input: s = "a", t = "aa"
Output: ""
Explanation: Two a’s are needed but s has only one.
Hint 1

Expand right until the window covers t, then shrink from the left while it still covers t.

Hint 2

Track a single counter missing instead of comparing maps.

Sliding WindowHash TableString