 All Problems
Minimum Window Substring
hard
sliding window
hash map
strings
facebook
amazon
google
linkedin

Given two strings s and t, return the minimum window in s that contains all characters of t (including duplicates). If no such window exists, return an empty string.

Example 1:

Input:
ADOBECODEBANC
ABC
Output: BANC

Example 2:

Input:
a
a
Output: a

Constraints:

  • 1 ≤ s.length, t.length ≤ 10⁵
  • s and t consist of uppercase and lowercase English letters

Input format: First line: string s. Second line: string t.

Output format: Minimum window substring, or empty string.

Run to check your code against the sample cases, or submit to run every case