Question bank › Queue
Dsa Queue Easy

The Service Bus Retry

A message broker processes tasks. Each task is at the front of a queue. When a task is processed, it either succeeds ('S') or fails ('F'). If it fails, it is moved to the back of the queue. However, a task can only fail a maximum of 2 times. If it fails a 3rd time, it is discarded. Given an initial queue of task IDs and a sequence of results, print the IDs of tasks that were completed successfully in the order they finished. Example: Input: T1 T2 T3 F F S S S Output: T3 T1 T2

Key concepts

queuesimulationstate-tracking

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.