Minimum Window Substring
Given two strings, original and check, return the shortest substring of original that
contains every character in check, including duplicates. If multiple valid substrings have
the same length, return the lexicographically smallest one.
Parameters
original: The source string.check: The required characters.
Result
- The minimum valid window in
original.
Examples
Example 1
Input: original = "cdbaebaecd", check = "abc"
Output: baec
Explanation: Both cdba and baec are valid windows of length 4. We return baec because
it is lexicographically smaller.
Constraints
1 <= len(check), len(original) <= 10^5originalandcheckcontain only uppercase and lowercase English letters. Characters are case-sensitive.