Z18
Minimum Window Substring
Problem Statement & Objective
Given two strings s and t of lengths m and n respectively, return the minimum window substring of s such that every character in t (including duplicates) is included in the window. If there is no such substring, return the empty string "".
Function Signature (Python)
min_window_substring(s: str, t: str) -> strInput & Output Contract
Output Rule:Smallest substring containing all characters of t, or "" if none exists.
System Constraints
m == s.length, n == t.length
1 <= m, n <= 10^5
s and t consist of uppercase and lowercase English lettersExample Execution Walkthrough
s = "ADOBECODEBANC", t = "ABC"
result: "BANC"Example Test Scenarios (4)
Example 1
Input:
["ADOBECODEBANC","ABC"]Expected Output:
"BANC"Example 2: Tek Karakter
Input:
["a","a"]Expected Output:
"a"Example 3: Yetersiz Tekrar
Input:
["a","aa"]Expected Output:
""İki Valid Minimum Pencere
Input:
["bab","ab"]Expected Output:
"ba"