FreeCareerPath
Build the PrimitiveHard

Minimum Window Substring

Write `min_window(s, t)` returning the shortest substring of `s` containing every character of `t` including duplicates. Return `""` when no such window exists. min_window("ADOBECODEBANC", "ABC") -> "BANC" Grow the right edge until the window is valid, then shrink the left edge while it stays valid, recording the best. The only way to keep this O(n) is a single counter of how many required characters are currently satisfied — checking validity by rescanning the window makes it O(n * k).

What to expect: A timer starts when you begin. Edit the starter code, run it against the test suite as many times as you like, then finish when you're done. The reference solution and interviewer follow-up questions unlock only after you finish.

Log in to start this session

Timed sessions and your results for "Minimum Window Substring" are saved to your account — logging in takes a few seconds.