Rate Limiter
AeroSpace • Sliding window on timestamps • deque / queue
Allow at most N events in any rolling window of length T (time units). Store event times in order; drop timestamps older than now − T from the front, then accept if fewer than N remain.
AllowO(k)k pops
TypicalO(1)amortized
SpaceO(N)window
Step0/0
Ready
Press Play or Step. Demo uses N = 2, T = 10. Each step shows
allow(now) and the deque of timestamps after the call.