Dashboard
LC #76

Minimum Window Substring

Pattern · ?AmazonGoogleMetaBloombergLinkedIn

Problem

Find the minimum window in string s which will contain all characters of string t.

Constraints

  • 1 ≤ s.length, t.length ≤ 10⁵
  • s and t consist of uppercase and lowercase English letters
  • Answer is guaranteed to exist if not empty string

Example

Input
s = "ADOBECODEBANC", t = "ABC"
Output
"BANC"
Why
Minimum window containing A, B, C is "BANC" (indices 9–12)

Spot the pattern

Which pattern cracks it?

Hints

One at a time
Solve on LeetCode ↗