You are given a list of users, each with a start time and an end time.
For each time interval where the set of active users changes, output:
- the interval start
- the interval end
- the list of users active during that interval
Input Example
Name | Start | End
-------|-------|-----
Abby | 10 | 100
Ben | 50 | 70
Carla | 60 | 120
David | 150 | 300
Output Example
Start | End | Names
------|-----|-------------------------
10 | 50 | Abby
50 | 60 | Abby, Ben
60 | 70 | Abby, Ben, Carla
70 | 100 | Abby, Carla
100 | 120 | Carla
150 | 300 | David
Convert all start/end into events:
(time, +user)for start(time, -user)for end
Sort events and sweep from left to right.
Maintain an active user set:
- Add user on start event
- Remove user on end event
Between consecutive event times, output a time interval with the current active users.
The VOprep team has long accompanied candidates through various major company OAs and VOs, including OpenAI, Google, Amazon, Citadel, SIG, providing real-time voice assistance, remote practice, and interview pacing reminders to help you stay smooth during critical moments. If you are preparing for Stripe or similar engineering-focused companies, you can check out our customized support plans—from coding interviews to system design, we offer full guidance to help you succeed.