Dsa
Queue
Easy
Ride Sharing Queue
In a ride-sharing application, drivers arrive at random times and can pick up passengers based on their arrival. Implement a program that simulates this process. The input consists of several lines where each line has two integers: the driver's arrival time and the time they need to pick up the passenger. The program should end with EOF. Print the total time taken for all pickups once all drivers have served their passengers.
Example Input:
0 3
1 2
2 3
Example Output:
8
Key concepts
queueschedulingsimulation
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