Minimum window substring
Given strings s and t, return the shortest contiguous substring of s that contains every character of t including multiplicities (e.g. if t has two 'a's, the window must too). If no such window exists, return the empty string. If there are multiple shortest windows, any one of them is acceptable but the reference returns the leftmost. For example, the minimum window of "ABC" inside "ADOBECODEBANC" is "BANC". s and t can each be up to 10^5 characters; aim for O(len(s)) time.
Implement
min_window(s: str, t: str) → strExamples
in
["ADOBECODEBANC","ABC"]out"BANC"What a strong answer looks like
State your approach and its time/space complexity out loud before you optimize. Handle the edge cases (empty input, duplicates, overflow), and say why you chose this over the brute force. Green tests are the floor, not the grade.
0:00 of about 35 min
solution.py
InputExpectedGot
["ADOBECODEBANC","ABC"]"BANC"not run yetsample