Coding Challenge

Minimum Window Substring

Hard
stringsliding-window

Find the smallest substring containing all target characters.

Given strings s and t, return the minimum window in s that contains all characters of t with the required frequencies. Return an empty string if no such window exists.

Examples

Input: s = "ADOBECODEBANC", t = "ABC"

Output: "BANC"

Constraints

  • Characters may repeat in t

Preparing your coding workspace...