Peak Concurrent Voice Calls per Customer Organization
Last updated: November 29, 2026
Quick Overview
Given voice call records (org_id, start, end) with half-open intervals, compute for each organization the maximum number of simultaneous calls and the earliest time that peak is reached.
Sierra
November 29, 20260
0
0 solved
Given voice call records (org_id, start, end) with half-open intervals, compute for each organization the maximum number of simultaneous calls and the earliest time that peak is reached.
Sierra runs voice agents for customers and needs to provision telephony and model capacity per organization. The interviewer is checking sweep-line fundamentals, especially the tie rule at equal timestamps, and whether you group work per key cleanly.
What the Interviewer Expects
- Turn each call into a +1 start event and a -1 end event
- Sort events so ends come before starts at the same timestamp
- Track the running count and the first time the max is hit
- Partition by organization without mixing events
- Handle zero or negative length calls
Key Topics to Cover
How to Approach This
- Clarify input constraints and edge cases before writing code.
- Walk through your approach verbally and confirm with the interviewer before coding.
- Start with a brute force solution, then optimize. Mention time and space complexity.
- Test your solution with examples, including edge cases like empty input or duplicates.
- Consider common patterns: sliding window, two pointers, hash map, BFS/DFS, dynamic programming.
Possible Follow-up Questions
- How would you compute this over a stream of calls that arrive out of order?
- How would you report the total time each org spends above a capacity threshold?
- What if you need the peak across all orgs combined in a sliding 24 hour window?
Sharpen Your Skills on Codemia
Practice similar problems with our interactive workspace, get AI feedback, and track your progress.
Practice DSA ProblemsSample Answer
Requirements
Each call is [start, end), so a call ending at 10 and one starting at 10 do not overlap. For every org return (peak, first_time). Calls with end <= start are invalid and are skipped. Orgs with o...
High-Level Design
Bucket events by org. For each org, sort (time, delta) pairs. Because -1 < +1, Python's tuple sort naturally places ends before starts at equal times, which is exactly the half-open rule. Sweep, u...