- Forgetting to shrink the window: Expanding without contracting leads to invalid windows. Always check validity and shrink when conditions are violated.
- Wrong window validity condition: Carefully define what makes a window valid. Off-by-one errors in the condition cause wrong answers.
- Not updating result at the right time: Update your answer when the window is valid, not after shrinking past validity.
Track result before or during the shrink phase.
- Using wrong data structure for frequency: Arrays work for lowercase letters ( slots). Use hash maps for unicode or larger character sets.