Your question is Smallest Covering Substring. Start with the requirements on the right.
Run and submit as often as you like. When you're ready, talk me through your approach or go straight to the code.
The SIXT app receives a user search query and a set of required characters from a matching rule. Find the shortest contiguous substring of source that contains every character in target, including duplicate occurrences. Matching is case-sensitive.
Return any shortest valid window. If no valid window exists, return an empty string.
Implement min_window(source, target):
source: a string containing the searchable text.target: a non-empty string containing the required characters.source that contains each character in target with at least the required frequency.Use a sliding-window approach suitable for large search queries.
def min_window(source, target):