Dsa
Queue
Medium
Event Notification System
You are designing an event notification system for a large conference. Attendees can register for specific events but may need to be notified if an event is full. A circular queue is to be implemented to manage notifications, storing attendance requests. Each request has a unique ID and a timestamp. When an event is full, the first request in the queue should be notified. If new requests come in while the queue is full, they will overwrite the oldest request. The input specifies the maximum capacity of the queue followed by pairs of (timestamp, request_id). Output the IDs of the notified requests in the order they were processed. Example: Input: 3 1 101 2 102 3 103 4 104 5 105 Output: [101, 102, 103].
Key concepts
queuecircular buffer
Practise this out loud — free
Start a mock interview on THIS exact question — a voice AI interviewer opens with it, pushes back like a real onsite, then hands you an instant scorecard.
🎙 Practise this question now