Question bank › Heap
Dsa Heap Easy

Emergency Response System

In an emergency response system, different incidents are reported with varying priority levels. Write a program that reads incidents along with their priority and returns the incident with the highest priority after each report. If multiple incidents have the same highest priority, return the one reported first. Input will be a list of incidents with their priorities followed by the string 'END'. Output should be the incident name with the highest priority after each incident is reported, including the incident reported last before 'END'. Example: Input: Fire 5 Accident 3 Flood 4 END Output: Fire Fire Fire

Key concepts

heappriority queuegreedy

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.