Question bank › Queue
Dsa Queue Easy

Customer Queue Management

You are tasked with simulating a customer service queue. Customers arrive at a service desk and can either check in or leave the queue. When servicing a customer, they are removed from the front of the queue. Implement a function that processes a series of customer actions and outputs the order in which they were served. Input Format: - The first line contains an integer N: the number of customer actions. - The next N lines each contain a string indicating an action: either 'CHECK_IN <name>' to check in a customer or 'LEAVE <name>' to remove a customer from the queue. The customer name is a single string without spaces. Output Format: - Print space-separated names of customers in the order they were served. Example: Input: 5 CHECK_IN Alice CHECK_IN Bob LEAVE Alice CHECK_IN Charlie CHECK_IN David Output: Bob Charlie David

Key concepts

queuesimulation

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.