Below is a high-yield, pattern-based set of sliding window problems. This covers all core variants:
- fixed vs variable window
- frequency tracking
- distinct constraints
- shrinking conditions
- deque optimization
1. Fixed-Size Window (Simplest Form)
Core Skill
- Maintain window of size k
Problems
- Maximum Average Subarray I
- Find All Anagrams in a String
Pattern
window_sum += nums[r]
if r >= k:
window_sum -= nums[r-k]
Concepts
- Add right, remove left
- No shrinking logic needed
2. Variable Window (Expand + Shrink)