Number of Recent Calls — interactive algorithm visualization

Easy · Queue · time O(n) · space O(n)

A FIFO queue of timestamps; evict from the front anything outside the window. Shows how a queue tracks a sliding time range.

Example input: pings = [1,100,3001,3002], window = 3000

Step through a verified execution trace - every step shows the real state, the invariant that keeps the algorithm correct, and asks you to predict what happens next.

Solve Number of Recent Calls in the editor · All 16 visualizations

Previous: Range Sum Query · Next: Sliding Window Maximum