Given strings s and t, return the smallest substring of s that contains every character of t (with multiplicity). Return '' if none.
The full expand-then-contract template with a 'how many chars still needed' counter.
Count what t needs. Expand right, decrementing need when you cover a required char. Once all requirements are met (missing === 0), contract from the left to find the smallest valid window, recording the best. This 'grow to satisfy, shrink to minimize' shape is the general sliding-window template — every variable-window problem is a variation of it. The `missing` counter avoids re-scanning the need-map each step: it goes to 0 exactly when the window is valid. Note the asymmetry — you only shrink while valid, so left never overshoots, keeping it O(|s| + |t|).
'Smallest window containing all of X' — the canonical hard sliding-window; keep a requirement counter.
Time O(|s| + |t|) · Space O(|t|)