Queue Check-in Simulation with Capacity Limit
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
There is a single check-in line. You are given an integer array arrivalTimes where arrivalTimes[i] is the time when person i arrives at the end of the line.
Rules:
Only one person is processed at a time. The person at the front takes 30 seconds to check in. When a person arrives, if the number of people currently waiting/being served in the system is greater than 10, that person leaves immediately and will not check in.
Return an array result:
If person i is served, result[i] is the time they start service. Otherwise, result[i] = null.
Assume arrivalTimes is non-decreasing; ties are enqueued in input order.
Input
Integer array arrivalTimes
Output
Array result (each entry is an integer or null) Constraints (suggested) 1 <= len(arrivalTimes) <= 2e5 0 <= arrivalTimes[i] <= 1e9
Examples
arrival=[0,0,0] → result=[0,30,60] arrival=[0,10,20] → result=[0,30,60] arrival=[0,100] → result=[0,100] 12 people arrive at time 0 → first 11 served, 12th leaves arrival=[0,15,15,16] → result=[0,30,60,90]
Complete solveOneQueueCheckInSimulation. It has one parameter, String input, containing the full stdin payload. Return the stdout payload as an array of lines, without trailing newline characters.
input = "3\n0 0 0" return = ["0 30 60"]
The returned string must match the expected standard output for the sample input.
Use the limits and requirements stated in the prompt.
- Count House Segments After DestructionOA · Seen May 2026
- Count Numbers with Even Number of DigitsOA · Seen May 2026
- Laser Robot Safe PathOA · Seen May 2026
- Longest Same-Character SubstringOA · Seen May 2026
- Cyclic Shift to Strictly Descending ArrayOA · Seen May 2026
- Dynamic Wall Building and Range QueryOA · Seen May 2026
- Get Function Execution TimeSeen Jan 2025
- Sum Digits Until OneSeen Dec 2024
public String[] solveOneQueueCheckInSimulation(String input) {
// write your code here
}