Advanced Sliding Window Problems for Coding Interviews
33 advanced Sliding Window problems from real coding interviews, each with test cases you can run online. By difficulty they split into 0 basic, 0 intermediate and 33 advanced. The companies that ask them most often are Google, Amazon, Meta, Bloomberg.
Solve a few problems of each level, name the pattern after each one and revisit the ones that needed a hint a week later. Practise stating the time and space complexity and the edge cases before you code.
Coding problems
- Sum of Subarray Minimums (Advanced)
- Maximum Subarray After One Deletion (Advanced)
- Longest Common Contiguous Segment (Advanced)
- Longest Equal Zeros and Ones Subarray (Advanced)
- Maximum Non-Overlapping Target Segments (Advanced)
- Minimum Window Substring (Advanced)
- Sum of Subarray Minimums (Advanced)
- Longest Subarray With Sum At Most K (Advanced)
- Traveling Salesperson With Time Windows (Advanced)
- Strange Printer (Advanced)
- Three Non-Overlapping Subarrays (Advanced)
- Minimum Increments to Form Target Array (Advanced)
- Sliding Window Maximum Values (Advanced)
- Shortest Subarray to Remove to Make Sorted (Advanced)
- Palindrome Removal (Advanced)
- Minimum Window Subsequence (Advanced)
- Make Sum Divisible by P (Advanced)
- Sum of Total Strength of Wizards (Advanced)
- Maximum Subarray Min-Product (Advanced)
- Number of Valid Subarrays (Advanced)
- Maximum Score of a Good Subarray (Advanced)
- Put Marbles in Bags (Advanced)
- Longest Subarray With Average at Least X (Advanced)
- Kth Smallest Subarray Sum (Advanced)
- Best Subarray Sum With Length Between Bounds (Advanced)
- Count Subarrays With Bitwise AND Equal to K (Advanced)
- Count Subarrays With Mex Equal to K (Advanced)
- Count Subarrays With Majority Element (Advanced)
- Maximum XOR of Any Subarray (Advanced)
- Sum of OR Over All Subarrays (Advanced)
- Sum of AND Over All Subarrays (Advanced)
- Subarrays With Sum in Range (Advanced)
- Shortest Window Containing 1 to K (Advanced)
Related
Frequently asked questions
How do I get good at sliding window problems?
Practise by level, name the pattern after you solve each problem and review the ones you needed hints for. The list is ordered so you can start with the basic ones.
Can I run sliding window problems online here?
Yes. Each problem opens in an editor that runs your code against test cases in Java, Python, C++, Go, JavaScript and more.