Find Time Ranges With Too Few Payment Processors Online
Last updated: November 29, 2026
Quick Overview
PayPal routes card payments through n acquiring processors, each with scheduled outage intervals [start, end) during a day of length D. Return the merged time ranges in which fewer than k processors are available.
PayPal
November 29, 20260
0
0 solved
PayPal routes card payments through n acquiring processors, each with scheduled outage intervals [start, end) during a day of length D. Return the merged time ranges in which fewer than k processors are available.
PayPal routes transactions across multiple acquirers and needs to know when redundancy is too thin to absorb another failure. This sweep-line problem checks whether you can turn interval events into counts, merge adjacent output ranges, and treat overlapping outages from the same processor correctly.
What the Interviewer Expects
- Convert intervals into +1/-1 events and sweep in time order
- Process ends before or together with starts at the same timestamp
- Merge adjacent output ranges
- Clip intervals to the day boundaries
- Address overlapping outages on the same processor
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
- What if one processor's outages overlap each other (it would be double counted)?
- How would you answer 'how many processors are up at time t' for many queries?
- How would you extend this to weight processors by capacity?
- How does this feed a routing decision in real time?
Sharpen Your Skills on Codemia
Practice similar problems with our interactive workspace, get AI feedback, and track your progress.
Practice DSA ProblemsSample Answer
Requirements
Inputs: outage tuples (processor, start, end) with half-open intervals, the processor count n, the threshold k and the day end D. Output: sorted, non-overlapping (start, end) ranges inside [0, D) ...
High-Level Design
Availability only changes at interval endpoints. Record a delta of -1 at each outage start and +1 at each end, aggregate deltas per timestamp, and walk the sorted timestamps carrying a running `availa...