Question bank › Queue
Dsa Queue Medium

Emergency Vehicle Dispatch

A city has a single dispatch center for emergency vehicles (ambulances, fire trucks, etc.). Each call for help has a severity level and arrival time. The vehicle should respond to the most severe call first. If two calls have the same severity, the earlier call is prioritized. You need to find the order of dispatch for all calls. Input Format: - The first line contains an integer N (1 <= N <= 1000), the number of emergency calls. - The next N lines each contain an integer severity_level and an integer arrival_time. Output Format: - A single line output showing the order of dispatch based on the severity and arrival time, as space-separated indices of emergency calls (0-indexed). Example: Input: 3 5 0 3 1 5 2 Output: 0 2 1

Key concepts

queuedispatchpriority

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.