Sliding Window
LC #76Hard
Minimum Window Substring
Sliding Window
AmazonGoogleMetaBloombergLinkedInProblem
Find the minimum window in string s which will contain all characters of string t.
stringsliding-windowhash-map
Constraints
- ›1 ≤ s.length, t.length ≤ 10⁵
- ›s and t consist of uppercase and lowercase English letters
- ›Answer is guaranteed to exist if not empty string
Example
Input
s = "ADOBECODEBANC", t = "ABC"Output
"BANC"Why
Minimum window containing A, B, C is "BANC" (indices 9–12)