Sliding Window interview questions
85 sliding window problems tagged across recent interview reports. Drilled most heavily by yandex, meta, and microsoft.
Sliding Window is the pattern behind 85 interview problems at companies like Yandex, Meta, and Microsoft. It solves a class of problems where you need to find optimal subarrays, substrings, or contiguous sequences that satisfy a constraint. Instead of recalculating from scratch at each position, you shrink and expand a window in one pass. The pattern appears deceptively simple until you hit a variant you haven't drilled, and then it's easy to time out or miss edge cases. If a hard Sliding Window problem lands in your live OA, StealthCoder solves it in seconds, invisible to the proctor.
Most-asked sliding window problems
Showing top 50 of 85 sliding window problems by # companies asking.
You can't drill every sliding window variant before the assessment. StealthCoder runs invisibly during screen share and solves whichever variant they throw at you. No browser extension. No detection signature. Made for the engineer who has done the work but might still blank with a webcam pointed at him.
Get StealthCoderYou recognize Sliding Window when the problem asks for the longest, shortest, or optimal contiguous subarray/substring with a property: max sum, min length, k distinct elements, no duplicates in range, character frequency constraints. Common subtypes include fixed-size windows (moving average), variable-size windows (two pointers), and windows with auxiliary data structures (hash map for character counts). The core trick is maintaining a window state incrementally rather than recomputing. Drill order: start with Contains Duplicate II and similar fixed patterns, move to Count Subarrays with Score Less Than K for variable windows, then tackle constrained variants like Constrained Subsequence Sum. Yandex, LinkedIn, and Goldman Sachs lean hard on this pattern. StealthCoder is the hedge for the variant you didn't drill, reading the exact constraint off the screen and delivering the window logic in real time.
Companies that hire most on sliding window
85 sliding window problems.
You won't drill them all. Pass anyway.
Sliding Window is one of the patterns interviews actually filter on. Memorizing every variant in a week is a fantasy. StealthCoder is the hedge: an AI overlay invisible during screen share. It reads the problem and surfaces a working solution in under 2 seconds, no matter which sliding window flavor lands in your live OA. Made for the engineer who has done the work but might still blank with a webcam pointed at him. Works on HackerRank, CodeSignal, CoderPad, and Karat.
Sliding Window interview FAQ
How many Sliding Window problems should I drill before an interview?+
With 85 problems in the pool, prioritize 12 to 15 canonical ones: start with Contains Duplicate II and III to understand window shrinking, then Count Subarrays with Score Less Than K for variable-size logic. Cover at least one hash map variant (character/number frequency) and one two-pointer variant. More drilling helps, but diminishing returns kick in fast.
Which company asks the most Sliding Window questions?+
Yandex leads with 44 problems tagged to this pattern, followed by Meta and Microsoft with 20 each. LinkedIn, Goldman Sachs, and Amazon all ask it heavily. If you're interviewing there, Sliding Window is non-negotiable.
How do I recognize a Sliding Window problem in the wild?+
Look for language like longest, shortest, maximum, minimum applied to a contiguous subarray or substring. Watch for constraint words: k distinct, exactly m occurrences, sum less than x, no duplicates. If the brute force is nested loops and the constraint is local to a range, it's likely Sliding Window.
What's the difference between fixed and variable window?+
Fixed window: size k stays constant, you move it once per iteration. Variable window: you expand right to satisfy a condition, shrink left when it breaks. Variable window is more common in interviews and often requires a two-pointer or hash map to track state.
What mistake do most people make on Sliding Window problems?+
Forgetting to shrink the window when the condition breaks, leading to incorrect sums or counts. Second: not handling edge cases like empty windows or single-character answers. Test with minimal inputs (k=1, array length 1) early.