Time-Window Counter
Published 3 October 2026
Onsite Coding Round 2 — Time-Window Counter¶
The second coding round combined object-oriented design with a counting problem. I needed to implement a counter class supporting put(), get_count(), and get_total_count(), with a fixed time window such as 300 seconds supplied when the class was initialized.
High-QPS Requirement¶
We discussed multiple possible designs, and the interviewer specifically asked me to implement the version where put() remained efficient under very high write throughput.
Production Follow-Ups¶
After coding, the interviewer asked how the design would change in a production environment and how I would handle concurrent or multithreaded access.