class Solution: def minWindow(self, s: str, t: str) -> str: i, j, n, m = 0, 0, len(s), len(t) tot, ans = 0, (1e9, (0, -1)) chs = {c:t.count(c) for c in t} for j in range(n): if s[j] in chs: chs[s[j]] -= 1 if chs[s[j]] >= 0: tot += 1 while tot == m: if s[i] in chs: chs[s[i]] += 1 if chs[s[i]] > 0: tot -= 1 if ans[0] > j-i+1: ans = j-i+1, (i, j) i += 1 return s[ans[1][0]:ans[1][1]+1]