Question bank › Queue
Dsa Queue Easy

Multi-Slot Task Parallelizer

A system has M processing slots. N tasks arrive at specific times, each with a duration. A task can start as soon as it arrives IF a slot is free. If all slots are full, it enters a queue and must wait until the earliest slot becomes free. If multiple slots become free at the same time, the task takes the one that became free first. Input: M (slots) and N (tasks). Then N lines: ArrivalTime and Duration. Output: For each task (in original order), print the time it finishes. Example: Input: 2 3 0 10 0 5 2 5 Output: 10 5 10

Key concepts

queuesimulation

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.