101. Minimum Window Substring
Hard
Given the strings texto and alvo, return the shortest contiguous substring of texto that contains all characters of alvo, including the required repetitions. If there is more than one minimum substring, return the one that starts first. If no such substring exists, return the empty string.
Example 1
Input: texto = "ADOBECODEBANC", alvo = "ABC"
Output: "BANC"
Example 2
Input: texto = "aabdec", alvo = "aabc"
Output: ""
Constraints
- 0 <= texto.length, alvo.length <= 10^5
- As strings contain ASCII characters.
StringsHash mapSliding window
Saved in this browser
Caso 1
texto =
"ADOBECODEBANC"
alvo =
"ABC"
Expected =
"BANC"
Caso 2
texto =
"aabdec"
alvo =
"aabc"
Expected =
"aabdec"
Run checks these 2 cases. Submit runs all 6, including hidden ones.