Minimum Window Substring
Given strings s and t, return the shortest contiguous substring of s that contains every character of t including duplicates. If no such substring exists, return the empty string.
Open official problem prompt ↗Locate the tightest contiguous slice of s that still contains all letters of t, honoring duplicates.
Dragging a shopping cart along a shelf: push the right edge until the cart holds every item on your list, then pull the left edge in to trim wasted shelf while the list stays complete.
- Input
- s = "ADOBECODEBANC", t = "ABC"
- Output
- "BANC"
- Why
- "BANC" is the shortest window of s that contains one A, one B and one C.
m == s.lengthn == t.length1 <= m, n <= 10^5s and t consist of uppercase and lowercase English lettersThe answer is unique if it exists