Smallest window covering every needed character
Given a string s and a non-empty string need, return the shortest contiguous substring of s that contains every character of need, repeats included: if need has two as, the window must hold at least two. Matching is case-sensitive. If several shortest windows tie, return the leftmost; if no window works, return "".
Aim for O(len(s) + len(need)) time.
Besides the tests, one large input (a 2,500-character string) with a ~300 ms limit (scaled to your device's speed): brute force won't pass.
Examples
min_cover("ADOBECODEBANC", "ABC")→"BANC"min_cover("a", "a")→"a"min_cover("a", "aa")→""