User Quota Scheduling with Expiring Assignments
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.
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.
1Example 1
The returned string must match the expected standard output for the sample input.
Constraints
Limits and guarantees your solution can rely on.
Use the limits and requirements stated in the prompt.