Question bank › Queue
Dsa Queue Easy

Weighted Triage Interleaving

A hospital uses two queues: High-priority (H) and Low-priority (L). To prevent Low-priority starvation, the doctor follows this rule: Process up to 2 High-priority patients, then process 1 Low-priority patient if one is available. If the High-priority queue is empty, process Low-priority patients. If the 2-High limit is reached but no Low-priority patients are waiting, continue with High-priority. Given a sequence of (Priority, PatientName), output the order in which patients are treated. Example: Input: H Alice H Bob H Charlie L Dave L Eve Output: Alice Bob Dave Charlie Eve

Key concepts

queuepriorityinterleaving

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