Dunzo Recent Delivery Calls Counter
Dunzo Recent Delivery Calls Counter
HardQueues0% accepted
Dunzo tracks API call frequency. Design RecentCounter class: ping(t) adds new call at time t and returns the number of calls in [t-3000, t]. Calls are always in increasing order of t.
Approach
Design a recent counter that counts pings in last 3000 milliseconds using a queue.
Input
ping(1)
ping(100)
ping(3001)
ping(3002)
Output
1 2 3 3
More Queues problems
Browse all coding problems →solution.py
Loading editor...
Test 1
Test 2
Test 3
Press Run to test your custom input, or Submit to judge against all test cases.
Sign in to continue
Create a free account to run code, submit solutions and track progress.
- Free forever — no credit card
- 10+ languages with live execution
- Points, streaks & leaderboards