Minimum Window Substring
Return the shortest substring of s containing every character of t with its required multiplicity. Return an empty string if impossible.
Example 1
s = "xxABCAy"
t = "AABC""ABCA"Explanation
ABCA contains two A letters, one B and one C; every shorter window misses an occurrence.
Example 2
s = "abc"
t = "zz"""Explanation
No z occurs in abc, so no valid window exists.
Example 3
s = "aa"
t = "aa""aa"Explanation
Both a occurrences are required, so the whole source is the shortest window.
Constraints
- 1 <= string lengths <= 100000
- Strings contain English letters
- The shortest valid window is unique when one exists
Function contract
minWindowArguments: json, jsonSolutionRuns on your device
Loading draft…
Run: 3 examples; Submit: 35 cases, on your device.
"xxABCAy""AABC"