hard

Minimum Window Substring

Given strings s and t, return the shortest contiguous substring of s that contains every character of t with at least the required multiplicity. If no such window exists return the empty string.

Constraints
  • 1 ≤ s.length, t.length ≤ 10^5
  • Uppercase and lowercase English letters
  • Answer is unique if it exists
Examples
in: s = "ADOBECODEBANC", t = "ABC"
out: "BANC"
in: s = "a", t = "aa"
out: ""

Code it yourself

Solve in
Test execution is not yet available for this exercise.Practice journal →Draft saved in this browser.
Hints:
Which approach applies?

Choose an approach to check your pattern recognition, or reveal the discussion when you need help.