Dsa
Queue
Medium
Email Queue System
You are designing an email system that processes incoming emails in the order they arrive. Each email has a timestamp of when it arrived and a processing duration. Your task is to simulate the processing of emails and output the time at which each email finishes processing.
Input Format:
- The first line contains an integer n, the number of emails.
- The next n lines contain two integers: arrival_time and processing_time.
Output Format:
- Print the finish time for each email in the order they arrive, each on a new line.
Example:
Input:
3
0 5
1 2
4 1
Output:
5
7
8
Key concepts
queueemail processingevent-driven
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