76. Minimum Window Substring
def minWindow(self, s, t):
"""
:type s: str
:type t: str
:rtype: str
"""
counter = collections.Counter(t)
count, start, end, head, res = len(t), 0, 0, 0, float('inf')
while end < len(s):
if counter[s[end]] > 0:
count -= 1
counter[s[end]] -= 1
end += 1
while count == 0:
if end - start < res:
res = end - start
head = start
if counter[s[start]] == 0:
count += 1
counter[s[start]] += 1
start += 1
return '' if res == float('inf') else s[head:head + res]