Dsa
Sliding Window
Easy
Minimum Window Substring
Given two strings S and T, return the minimum window substring of S that contains all the characters in T. If there is no such substring, return an empty string.
Input:
- The first line contains the string S (1 <= |S| <= 10^7).
- The second line contains the string T (1 <= |T| <= 10^7).
Output:
- Output the minimum window substring if it exists; otherwise, an empty string.
Example:
Input:
ADOBECODEBANC
ABC
Output:
BANC
Key concepts
sliding_windowsubstringhash_table
Practise this out loud — free
Start a mock interview on THIS exact question — a voice AI interviewer opens with it, pushes back like a real onsite, then hands you an instant scorecard.
🎙 Practise this question now