-
Notifications
You must be signed in to change notification settings - Fork 1
Description
Problem Statement:
Given two strings sand t, return the minimum window substring of ssuch that every character in t(including duplicates) is included in the window. If there is no such substring, return the empty string "".
Note:
For duplicate characters in t, the substring must contain at least the same number of each character as in t.
If such a substring exists in s, it is guaranteed to be unique.
Examples:
Input: s = "ADOBECODEBANC", t = "ABC"
Output: "BANC"
Explanation: The substring "BANC"contains 'A', 'B', and 'C'from string t.
Input: s = "a", t = "a"
Output: "a"
Explanation: The entire string sis the substring.
Input: s = "a", t = "aa"
Output: ""
Explanation: Both 'a's from tmust be included in the substring, but shas only one 'a', so no valid substring exists.
Constraints:
m == s.length
n == t.length
1 <= m, n <= 10^5
sand tconsist of uppercase and lowercase English letters.