Peak Number of Concurrent Rate Locks Across Applicants
Last updated: November 29, 2026
Quick Overview
Each approved applicant holds a rate lock over an inclusive day range [start, end]. Return the maximum number of locks active on any single day and the first day that maximum is reached.
Upstart
November 29, 20260
0
0 solved
Each approved applicant holds a rate lock over an inclusive day range [start, end]. Return the maximum number of locks active on any single day and the first day that maximum is reached.
When Upstart shows an approved offer, the rate is honored for a window, and capital markets wants to know peak outstanding commitments to plan funding. Interviewers use this to test the sweep line pattern and careful handling of inclusive boundaries.
What the Interviewer Expects
- Convert intervals into +1 and -1 events
- Handle inclusive end days correctly
- Order ties so a lock ending does not overlap one starting the next day
- Track the first day of the peak
- Analyze O(n log n) cost
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 every maximal day range where the peak holds.
- Locks carry dollar amounts; find the peak committed dollars instead.
- How would you answer this query in real time as locks are created and released?
Sharpen Your Skills on Codemia
Practice similar problems with our interactive workspace, get AI feedback, and track your progress.
Practice DSA ProblemsSample Answer
Requirements
Intervals are inclusive on both ends, so a lock [3, 5] is active on days 3, 4 and 5. A lock ending on day 5 and another starting on day 6 never overlap. Output (peak, first_day); return (0, None) for ...
High-Level Design
Emit a +1 event at start and a -1 event at end + 1. Sort by day, and on equal days process -1 before +1 so a lock that expired does not get counted with a lock that begins that day. Walk the event...