Reported September 2026
LinkedInsliding window

Minimum Window Substring

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

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

The detail that matters in this LinkedIn question, reported in September 2026, is the multiplicity clause. t = "aa" against s = "a" returns an empty string, because the window needs two copies, not just the letter. That one line is where most wrong answers die. It's Minimum Window Substring, a sliding-window problem with a count map, and the tie-break rule says the earliest start wins. If you've got an OA invite, this is worth ten minutes of your night. StealthCoder sits invisibly on your screen as a safety net if you blank mid-assessment, but the pattern below is simple enough to carry in your head.

The problem

Given strings s and t, return the shortest contiguous substring of s that contains every character of t, including repeated characters with their required multiplicities.
If no such substring exists, return the empty string. If several valid windows have the same minimum length, return the one that starts earliest in s.

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

Examples
Example 1
s = "ADOBECODEBANC"
t = "ABC"
return = "BANC"
BANC is the shortest window containing A, B, and C.
Example 2
s = "a"
t = "aa"
return = ""
The source string does not contain two copies of a.
Example 3
s = "abdcab"
t = "ab"
return = "ab"
Two length-two windows qualify, so the earlier one is returned.

Constraints
1 <= s.length, t.length <= 10^5.
s and t contain ASCII letters and digits.

Reported by candidates. Source: FastPrep

Pattern and pitfall

Count the characters t needs in a hash map and track a single number, how many required characters are still missing. Expand the right pointer through s, decrementing the need for each character. When the missing count hits zero, the window is valid. Now shrink from the left while it stays valid, recording the best length each time. Only record a new best when the length is strictly smaller, and the earliest-start tie-break is handled for free. The pitfall is checking validity by comparing two full maps on every step, which turns O(n) into O(n times alphabet) and gets sloppy. Another trap is ignoring duplicates in t. With s and t up to 10^5, anything quadratic times out. Use a missing counter, not map comparisons. If you freeze on the shrink logic during the live OA, StealthCoder is the hedge that hands you the working loop.

Drill it cold or hedge it with StealthCoder. Either way, don't walk into the OA hoping you remember the trick.

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. Made for the candidate who got the OA invite this morning and has 72 hours, not six months.

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 LinkedIn's OA.

LinkedIn reuses patterns across OAs. Made for the candidate who got the OA invite this morning and has 72 hours, not six months. Works on HackerRank, CodeSignal, CoderPad, and Karat.

Minimum Window Substring FAQ

What's the trick to Minimum Window Substring?+

Keep a need-count map for t and a single counter of characters still missing. Move the right pointer to grow the window, and once the counter hits zero, move the left pointer to shrink it while it stays valid. Record the smallest window seen. Each index is visited at most twice, so it's O(n).

How hard is this problem really?+

It's labeled hard, but the pattern is mechanical once you've seen it. The difficulty is in the bookkeeping, not the idea. Duplicates in t, the missing counter, and shrinking at the right moment cause most bugs. Write it once from memory tonight and it stops feeling hard.

How do I handle the tie-break for equal-length windows?+

Update your best answer only when the new window is strictly shorter than the current best. Since the left pointer moves rightward, the first window found at any given length starts earliest. That satisfies the earliest-start rule without any extra comparison logic.

What edge cases should I test before submitting?+

Test when t is longer than s, when t needs repeated characters like "aa" against "a", and when s equals t exactly. Also test when the answer is the whole string and when no window exists, which must return an empty string. Digits and mixed case count as distinct characters.

How do I prepare for this in 48 hours?+

Code it from scratch twice using an array or hash map for counts and a missing counter. Then run the three examples from the statement by hand. Also skim related sliding-window variants, like longest substring without repeating characters, so the expand and shrink rhythm feels automatic.

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

OA at LinkedIn?
Invisible during screen share
Get it