Minimum Window Substring
Minimum Window and Advanced Constraints DSA practice problem on Onlearn.
Difficulty: hard.
Topics: Minimum Window Substring, Sliding Window, Hash Map, Frequency Counting, Strings, String Manipulation, Time Complexity, Space Complexity, Optimization, sliding window, counting, hash map, string searching, two pointer technique, Frequency Counting.
Minimum Window Substring Given two strings S and T of lengths N and M respectively, find the minimum window substring of S such that every character in T (including duplicates) is included in the window. If there is no such window, return an empty string. The answer is guaranteed to be unique. Input Specification The first line contains a string S (1 <= N <= 10^5). The second line contains a string T (1 <= M <= 10^5). Both S and T consist of uppercase and lowercase English letters. Output Specification Return the smallest substring of S that contains all characters of T. If no such substring exists, return an empty string. Constraints 1 <= N, M <= 10^5 S and T consist of English letters (uppercase and lowercase). Sample Test Cases Sample Input 1: Sample Output 1: Explanation: The smallest window which contains all characters from "ABC" is "BANC". Sample Input 2: Sample Output 2: Sample Input 3: Sample Output 3: