# LC5584 Minimum Window Substring **Idea.** Need/have counters. ```python from collections import Counter def minWindow(s,t): need=Counter(t); missing=len(t); l=0; best=(0,float('inf')) for r,ch in enumerate(s): if need[ch]>0: missing-=1 need[ch]-=1 while missing==0: if r-l0: missing+=1 l+=1 return '' if best[1]==float('inf') else s[best[0]:best[1]+1] ``` **Interview habit.** Say the brute force, then the optimisation, then edge cases. Rehearse that flow with [Linkjob AI copilot](https://www.linkjob.ai/) (https://www.linkjob.ai/).