Question bank › Queue
Dsa Queue Medium

Cafeteria Line Management

You are managing a cafeteria where students line up to buy their meals. Each student will take a certain amount of time to complete their purchase. Whenever a student arrives, if there are students being served, they will wait in line. Your task is to simulate this scenario and determine the time when each student finishes their transaction. Input Format: - The first line contains an integer n, the number of students. - The next n lines contain two integers: arrival_time and purchase_time. Output Format: - Print the finish time for each student in the order they arrive, each on a new line. Example: Input: 3 0 4 1 2 3 1 Output: 4 6 7

Key concepts

queuesimulationevent processing

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
Part of InterviewLab's verified interview question bank. We show the prompt and concepts to practise with — never a copy-paste solution.