Reported September 2026
Lyftsliding window

Minimum Window Substring

Reported by candidates from Lyft's online assessment. Pattern, common pitfall, and the honest play if you blank under the timer.

Get StealthCoderRuns invisibly during the live Lyft OA. Under 2s to a working solution.
Founder's read

The whole solution hinges on a frequency map of t's characters, and that's what Lyft put in front of candidates in September 2026 with Minimum Window Substring. Find the shortest chunk of s that covers every character of t, duplicates included. The hinted pattern is sliding window, and with s and t up to 2 * 10^5 characters, brute force dies fast. If your OA invite lands this week, this is a problem worth having cold. And if you blank mid-assessment, StealthCoder runs invisibly as a safety net while you work through it.

The problem

Given strings s and t, return the shortest contiguous substring of s that contains every character of t, including duplicate occurrences.
If no such substring exists, return the empty string. The answer is guaranteed to be unique whenever it exists.

Function
minWindow(s: String, t: String) → String

Examples
Example 1
s = "ADOBECODEBANC"
t = "ABC"
return = "BANC"
"BANC" contains A, B, and C, and no shorter substring contains all three.
Example 2
s = "a"
t = "a"
return = "a"
The entire source string is the only window and contains the required character.
Example 3
s = "a"
t = "aa"
return = ""
The source string has only one a, so it cannot satisfy the target multiplicity.

Constraints
1 <= s.length, t.length <= 2 * 10^5.
s and t contain printable ASCII characters.
If a valid minimum window exists, it is unique.

Reported by candidates. Source: FastPrep

Pattern and pitfall

The trick is two pointers plus a need-count map. Build counts for t, then expand the right pointer, decrementing the count for each character you absorb. Track a single integer, how many required characters are still missing. When it hits zero, the window is valid, so shrink from the left as far as you can while it stays valid, recording the best length and start index. Then drop one left character to break validity and keep going. The common pitfall is duplicates. Example 3 (s = "a", t = "aa") fails if you only track a set of characters. Count occurrences, not presence. Another slip is recomputing validity by scanning the whole map each step, which makes it O(n * 128). Use the missing counter instead. Total work is O(n + m). If the shrink loop tangles your head live, StealthCoder is the hedge that gets you unstuck.

If this hits your live OA and you blank, StealthCoder solves it in seconds, invisible to the proctor.

If this hits your live OA

You can drill Minimum Window Substring cold, or you can hedge it. StealthCoder runs invisibly during screen share and surfaces a working solution in under 2 seconds. The proctor sees the IDE. They don't see what's behind it. Built by an Amazon engineer who would have shipped this the night before his JPMorgan OA if he'd had it.

Get StealthCoder

Related leaked OAs

⏵ Practice the LeetCode equivalent

This OA pattern shows up on LeetCode as minimum window substring. If you have time before the OA, drill that.

⏵ The honest play

You've seen the question. Make sure you actually pass Lyft's OA.

Lyft reuses patterns across OAs. Built by an Amazon engineer who would have shipped this the night before his JPMorgan OA if he'd had it. Works on HackerRank, CodeSignal, CoderPad, and Karat.

Minimum Window Substring FAQ

How hard is Minimum Window Substring really?+

It's a hard-rated problem, but the idea is a standard sliding window. Most of the difficulty is bookkeeping: duplicates, the missing counter, and the shrink loop. Once you've written it once, it's about 25 lines. Dry-run Example 1 by hand and it clicks.

What's the trick to getting it right?+

Keep a count map of t and an integer for how many required characters are still missing. Expand right, decrement. When missing hits zero, shrink left while the window stays valid. Only count a character as satisfied when its need goes from positive to zero, not when it merely appears.

What's the time and space complexity?+

Time is O(n + m), since each pointer moves across s at most once. Space is O(k) where k is the number of distinct characters. The inputs are printable ASCII, so a fixed array of 128 slots works and is faster than a hash map.

Which edge cases should I test before submitting?+

Test t longer than s, which returns an empty string. Test t with repeated characters, like s = "a" and t = "aa". Test s equal to t. Test a match at the very start or very end of s. Also confirm you return an empty string, not null, when nothing matches.

How do I prepare for this in 48 hours?+

Write the solution from scratch twice without looking. Then solve one or two related sliding window problems with a count map, like finding anagrams or longest substring without repeats. Focus on the expand-then-shrink loop structure, since that template carries over to most window questions.

Problem reported by candidates from a real Online Assessment. Sourced from a publicly-available candidate-aggregated repository. Not affiliated with Lyft.

OA at Lyft?
Invisible during screen share
Get it