Question bank › Queue
Dsa Queue Medium

Medical Queue

In a hospital, patients are treated based on their medical condition severity. Each patient has a severity level. You are to simulate the patient treatment queue where higher severity (lower number) should be treated first. If two patients have the same severity, the one who arrived first is treated first. Your task is to implement the queue behavior. The program will receive the number of patients followed by their names and severity levels. Output the names of the patients in the order they will be treated. Example Input: 4 Alice 2 Bob 1 Charlie 1 David 3 Example Output: Bob Charlie Alice David

Key concepts

queueprioritysimulation

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.