Smallest Covering Window
Return the shortest substring of s that contains every character of t, including repeats. If several are equally short, return the leftmost. Return "" if none exists.
Requirements
- Run in time.
Examples
EXAMPLE WALKTHROUGHclassic
A guided view of the published example, not a trace of your code.
INPUT
["ADOBECODEBANC","ABC"]TASKsmallest_covering_window()
EXPECTED OUTPUT
"BANC"Start with the input values shown in this example.
Example 1 of 3
Input: s = "ADOBECODEBANC", t = "ABC"
Output: "BANC"
Explanation: classic
Input: s = "a", t = "a"
Output: "a"
Explanation: exact match
Input: s = "a", t = "aa"
Output: ""
Explanation: not enough copies
Hint 1
Expand the right edge until the window covers t, then shrink the left edge while it still covers.
Hint 2
Track how many required characters are still missing.