Framework Thinking - Neetcode 150 - Minimum Window Substring

Here is the problem of Minimum Window Substring.

1. Understand the problem

Goal: Given strings s (source) and t (target), find the smallest substring in s that contains all characters of t with at least the same counts. Return that substring; if none exists, return “”.

Important details to keep in mind (common interview gotchas):

  • Characters are case-sensitive (A ≠ a).

  • t may contain duplicates → counts matter.

  • If t is empty, what to return? (conventionally “” or maybe s — we should clarify).

  • If s is empty or shorter than t, return “”.

2. Clarifying questions

  1. What are allowed characters? ASCII? Unicode?

  2. Are s and t non-empty? What to return if t is empty?

=> If t is empty, return “”, due to “” is the shortest string that match with t.

  1. Should solution be optimized for time? Any expected complexity?

  2. Should we return the first minimum window if multiple windows have same length?

=> Return the leftmost one.

  1. Are characters only lowercase?
Last Updated On November 3, 2025