Minimum Window Substring

Given two strings *s* and *t*, return the minimum window substring of *s* such that every character of *t* (including multiplicity) is included. If there is no such window, return the empty string. If there are multiple answers, you may return any one of them.

Input Format

s = "text string", t = "target characters"

Output Format

String (minimum window containing all chars of t)

Constraints

  • 1 <= s.length, t.length <= 10^5; s and t consist of uppercase and lowercase English letters.

Examples

Example 1:

Input:

s = "ADOBECODEBANC"
t = "ABC"

Output:

BANC

Explanation:

"BANC" is the smallest substring containing A, B, and C.

Example 2:

Input:

s = "a"
t = "a"

Output:

a

Explanation:

The whole string is the minimum window.

Loading...
Minimum Window Substring - Hashing DSA Problem