🧠 Drill · Think it through
The emergency room queue
The problem
Patients arrive at an ER over time, each tagged with an urgency number. After every arrival you must immediately treat the single most urgent patient waiting, then keep going as new patients keep arriving. Return the order in which patients are treated. The set of waiting patients keeps changing, and you repeatedly need the most urgent one right now.
Don't jump to code. Walk the four questions an expert asks first — you'll build the habit, not just the answer.
1
Restate it
Before anything else — did you read what's actually being asked? Strip the story to the bare goal.
Strip away the story. What does each step actually need?