Basic Sliding Window Problems for Coding Interviews
17 basic Sliding Window problems from real coding interviews, each with test cases you can run online. By difficulty they split into 17 basic, 0 intermediate and 0 advanced. The companies that ask them most often are Amazon, Google, Microsoft, 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
- Maximum Sum of a Window (Basic)
- Circular Window Maximum (Basic)
- Maximum Sum Subarray of Length K (Basic)
- Count Subarrays With Median K (Basic)
- Maximum Sum of K Disjoint Segments (Basic)
- Rate Limiter Sliding Log (Basic)
- Event Time Window Join (Basic)
- Degree of an Array (Basic)
- Make Two Arrays Equal by Reversing Subarrays (Basic)
- Maximum Ascending Subarray Sum (Basic)
- At Most One Segment of Ones (Basic)
- Three Parts With Equal Sum (Basic)
- Subarrays of Size K With Average at Least Threshold (Basic)
- Number of Zero-Filled Subarrays (Basic)
- Number of Recent Calls (Basic)
- Longest Alternating Parity Block (Basic)
- Alarm Rings in a Window (Basic)
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.