Question bank › Queue
Dsa Queue Easy

The Ghost Deletion Queue

In a task processing system, tasks are added to a queue. However, a task can be cancelled (deleted) at any time before it is processed. If a task ID is deleted, all instances of that ID currently in the queue must be ignored when they eventually reach the head of the queue. Input Format: Commands: 'ADD ID', 'DELETE ID', 'PROCESS'. Output Format: For 'PROCESS', print the ID of the task being handled. If no valid tasks remain, print 'EMPTY'. Example: Input: ADD 101 ADD 102 DELETE 101 PROCESS PROCESS Output: 102 EMPTY

Key concepts

queuehashmap

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.