User Quota Scheduling with Expiring Assignments
Reported by candidates from Circle's online assessment. Pattern, common pitfall, and the honest play if you blank under the timer.
You've got a scheduling problem from Circle, reported May 2026. A user system with quotas, task assignments, expiring intervals, and rejection logic. This is an interval overlap problem wrapped in simulation. You need to track concurrent active assignments per user, check if a new interval would exceed quota at any point in time, and output accept/reject for each attempt. StealthCoder will read the input format and feed you the pattern in real time if you blank on the interval sweep logic.
The problem
Complete the function below. The function receives the full standard input as a single string and must return the exact standard output lines for the described problem. Original prompt Problem: User Quota Scheduling with Expiring Assignments (Level 3) Implement a user/task scheduling system. Requirements Create user: each user has a quota meaning the maximum number of concurrent assignments allowed for that user. Assign a task: assign to a user a time interval [startTime, endTime) with a taskId. Rules Each assignment is active on the half-open interval [startTime, endTime). Once endTime is reached, the assignment expires and no longer counts toward the user's concurrent quota. Example: existing assignment [4,10) no longer counts for any t >= 10. If adding a new assignment would make the number of concurrent active assignments exceed quota at any time, the assignment must be rejected. Output For each assignment attempt, output whether it succeeds (e.g., true/false or OK/FAIL per spec). Constraints Potentially large, but OA tests may be small; a straightforward approach may pass. Test ideas quota=1: add [4,10) ok; add [10,12) ok. quota=1: add [4,10) ok; add [9,12) reject. quota=2: adding a third overlapping interval should reject. Edge: zero-length intervals (per spec). Multiple users are independent. Function Description Complete solveUserQuotaScheduling. It has one parameter, String input, containing the full stdin payload. Return the stdout payload as an array of lines, without trailing newline characters. The returned string must match the expected standard output for the sample input. Use the limits and requirements stated in the prompt.
Reported by candidates. Source: FastPrep
Pattern and pitfall
The core trick is interval overlap detection. For each new assignment [startTime, endTime), you must check whether adding it causes the concurrent count to exceed quota at any moment. A naive approach counts overlaps for every time point, which is slow. The fast move is to collect all relevant time boundaries (starts and ends), sort them, and sweep left to right, tracking the active count. At each boundary, update the count and verify it never exceeds quota. Expiration is the key detail: endTime is exclusive, so an assignment [4,10) does NOT conflict with [10,12). Edge cases matter: zero-length intervals, multiple users (independent quotas). StealthCoder is your safety net if you freeze on the sweep logic during the live OA.
If you see this problem in your OA tomorrow, the play is to recognize the pattern in 30 seconds. StealthCoder buys you that recognition.
You can drill User Quota Scheduling with Expiring Assignments cold, or you can hedge it. StealthCoder runs invisibly during screen share and surfaces a working solution in under 2 seconds. The proctor sees the IDE. They don't see what's behind it. Built by an Amazon engineer who passed his OA cold and still thinks the filter is broken.
Get StealthCoderRelated leaked OAs
This OA pattern shows up on LeetCode as meeting rooms ii. If you have time before the OA, drill that.
You've seen the question.
Make sure you actually pass Circle's OA.
Circle reuses patterns across OAs. Built by an Amazon engineer who passed his OA cold and still thinks the filter is broken. Works on HackerRank, CodeSignal, CoderPad, and Karat.
User Quota Scheduling with Expiring Assignments FAQ
What's the actual trick here?+
Interval overlap at a point in time. Sort all start and end boundaries, sweep left to right tracking active count. Check that count never exceeds quota. Half-open intervals are critical: [4,10) ends before [10,12) starts, so they don't overlap.
Is this a greedy problem or a DP problem?+
Neither. It's simulation with interval overlap detection. You process each assignment request in order and decide accept/reject based on a point-in-time conflict check. No optimization or state reuse across users.
How do I handle multiple users?+
Each user has an independent quota and independent assignment list. Process each assignment request: parse user and interval, check that user's assignments, accept or reject. No cross-user logic.
What's the time complexity I should target?+
For each assignment, you sweep all boundaries of existing assignments. If there are N existing assignments, that's O(N log N) per query. For a full OA, O(Q * N log N) where Q is queries. Straightforward and should pass.
How do I parse and format the input/output?+
The problem says stdin/stdout. Parse line by line for each command (create user, assign task). Output true/false or OK/FAIL per spec. The sample input/output will show exact format. Match it exactly.