Question bank › Queue
Dsa Queue Medium

Toll Booth Management

You are running a toll booth for a highway. Cars arrive at random intervals with varying service times. Each toll booth can service one car at a time, and a maximum of `N` cars can wait in line at any given time. Cars are represented by (arrival_time, service_time). Your task is to determine how long each car waits before being served. Print the wait time for each car in the order they arrive. If a car cannot be served due to the line being full, it is not serviced. Example: Input: 3 0 2 1 5 2 1 5 Output: [0, 1, 0].

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.