← All problems

Minimum Window Substring

Hard stringssliding-windowhash maps LeetCode ↗
Smallest substring of s containing all characters of t (with frequencies).

Hints (0/3 revealed)

Log in to reveal hints progressively.

Complexity

Time O(n + m), Space O(m)

Common pitfalls

  • Shrinking before the window is valid
  • Not handling duplicate chars in t

Your solution

Log in to save your code and track progress.