Question bank › Queue
Dsa Queue Easy

Multi-Slot Downloader

A file downloader can handle exactly K concurrent downloads. Files arrive at specific times and take a set number of seconds to download. If a file arrives and a slot is available, it starts downloading immediately. If all K slots are occupied, the file enters a First-In-First-Out (FIFO) queue. As soon as any file finishes, the next file in the queue (if any) starts downloading. Calculate the time each file finishes. Input Format: Line 1: An integer K (max slots). Subsequent lines: Two space-separated integers, ArrivalTime and Duration. Output Format: One integer per line representing the finish time of each file in the order they were provided in the input. Example: Input: 1 0 5 2 5 Output: 5 10

Key concepts

queuescheduling

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.