Peak Number of Concurrent Live Auctions
Last updated: November 29, 2026
Quick Overview
Given auction listings as (start_time, end_time) pairs, return the maximum number of auctions live at the same moment and the earliest time that peak is reached. An auction ending at time t is no longer live when another starts at t.
eBay
November 29, 20260
0
0 solved
Given auction listings as (start_time, end_time) pairs, return the maximum number of auctions live at the same moment and the earliest time that peak is reached. An auction ending at time t is no longer live when another starts at t.
Auctions end at fixed times on eBay, and capacity planning for the bidding service cares about how many are live and closing together. This onsite question checks the sweep line pattern, careful tie handling at shared timestamps, and whether you can extend it to per-minute ending load.
What the Interviewer Expects
- Convert intervals into +1 and -1 events
- Order ends before starts at equal timestamps, matching the half-open rule
- Track the running count and the first time the peak occurs
- O(n log n) time from sorting
- Compare with a min-heap of end times and explain when each fits
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
- Return the full timeline of counts so ops can graph it.
- Find the minute with the most auctions ending, since that drives last-second bid load.
- How would you compute this over a day of listings that do not fit in memory?
- What if start and end are both inclusive?
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 auction is live on the half-open interval [start, end). Return (peak, time). With no auctions, return (0, None). Times are integers (epoch seconds)....
High-Level Design
Turn every auction into two events: (start, +1) and (end, -1). Sort and walk in order with a running counter. The tie rule is the classic bug: at the same timestamp an ending must be processed bef...