Hard · Strings
Min window substring
Given strings s and t, return the shortest substring of s that contains every character of t, counting repeats (the leftmost one if several are equally short), or "" if no substring does.
Examples
Example 1
s="ADOBECODEBANC", t="ABC"Output: "BANC"
Example 2
s="aa", t="aa"Output: "aa"
Rebuild it in the studio
Read every interview problem free. Ten rooms need no account. A token opens a problem in full — Pro never counts.