Module 16 · The STL in Competitive Programming: Which Container for Which Problem
Sliding Windows and Two Pointers, With Their Proofs
ProReading
Zara checks the largest reading in every three-minute stretch of a cooler log. Most readings stay when the stretch moves. Scanning them again throws away that overlap. She wants to keep just enough information to answer the next stretch.
Checking what this lesson needs for you…
What is inside Sliding Windows and Two Pointers, With Their Proofs
- Name the window and its candidates
- Expire indexes from the front
- Prune weaker candidates from the back
- Append, report, and account for all work
- Two pointers need a monotone reason
- Sorted matching uses another monotone boundary
- Choose what a moving window must remember