Dsa
Queue
Medium
Grocery Store Checkout
You are overseeing a grocery store checkout system where customers arrive at certain times and take a fixed amount of time to checkout. Customers are served in FIFO order. Given the arrival times and checkout durations, calculate the time at which the last customer finishes checking out.
Input Format:
- The first line contains an integer N (1 <= N <= 1000), the number of customers.
- The next N lines each contain an integer arrival_time and an integer checkout_time.
Output Format:
- A single integer representing the time at which the last customer finishes.
Example:
Input:
3
0 3
2 2
4 1
Output:
6
Key concepts
queuecheckoutsimulation
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