Skip to content
LakeBench
ProblemsCommunityPricing
Sign inStart practicing

Min Window Substring

Python data engineering interview problem. Difficulty: intermediate. Pattern: Sliding Window. About 14 minutes. Part of the Pro drill bank.

Smallest window in s covering all characters of t. Treat this as a production helper: match the contracted return shape, including empty and duplicate inputs.

Implement min_window(s: str, t: str) -> str returning the minimum window of s covering every char in t (with multiplicity). If impossible, return "".

Constraints

  • Case-sensitive.

Examples

Input: min_window('ADOBECODEBANC', 'ABC') Output: BANC BANC is the shortest cover.

Topics: lakebench, python, window, coverage.

More Python interview questions · All interview problems · Learn data engineering

intermediate

Min Window Substring

Interview-style drill: Smallest window in s covering all characters of t.

Implement `min_window(s: str, t: str) -> str` returning the minimum window of s covering every char in t (with multiplicity). If impossible, return `""`. Example: `"ADOBECODEBANC", "ABC"` → `"BANC"`. Keep the harness.