Dsa
Queue
Easy
Rate-Limited Message Sender
A system sends messages at a rate of at most one message every C seconds. When a message arrives at time T, it is placed in a queue. If the sender is busy, the message waits. The sender processes the next message in the queue as soon as C seconds have passed since the START of the previous message's transmission (or immediately if the sender is idle). Given C and a sequence of (Name, ArrivalTime), output the time each message starts being sent.
Example:
Input: 5 MsgA 0 MsgB 1 MsgC 2
Output: MsgA:0 MsgB:5 MsgC:10
Key concepts
queuerate-limitingsimulation
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