Smallest Covering Substring
Given strings s and t, return the shortest contiguous substring of s that contains every character of t, including duplicates (if t has two as, the substring needs at least two).
If several shortest substrings exist, return the one that starts earliest. If none exists, return the empty string.
Example 1
Input: s = "ADOBECODEBANC", t = "ABC" Output: "BANC"
Example 2
Input: s = "a", t = "aa" Output: ""
Constraints
- 1 <= s.length, t.length <= 10^5
- s and t consist of English letters.
Hint 1
Track how many required characters are still missing from the current window.
Hint 2
Grow the window to the right until nothing is missing, then shrink it from the left as far as possible, recording the best window.
Good practice for: Frontend Developer, Backend Developer, Full Stack Developer, Mobile App Developer, Game Developer, Automation Test Engineer
Run checks your code on 2 sample tests. Submit runs all 9 tests, including hidden ones, and earns points. Use console.log to debug. Python's first run can take a few seconds while it starts.