Please read the instructions carefully before starting the exam.
Once you start the exam, the timer will begin, and you cannot pause it.
Ensure that you complete and submit your code within the given time if the timer is enabled.
A customer service call center handles incoming calls using a First-In-First-Out (FIFO) queue system.
There are two types of operations:
CALL <name>
— a customer with the given name joins the queue.ANSWER
— the agent picks the first customer in the queue and removes them."EMPTY"
.
"CALL <name>"
(name is a single word with only letters)"ANSWER"
A single string with all remaining customers in the queue, separated by commas. If the queue is empty, return "EMPTY"
.
0 ≤ operations.length ≤ 10⁵
"ANSWER"
does nothing if the queue is emptyinput: ["CALL Alice", "CALL Bob", "ANSWER"] output: "Bob" Explanation: Alice enters → [Alice] Bob enters → [Alice, Bob] ANSWER → Alice removed → [Bob]
input: ["ANSWER", "CALL Tom", "CALL Jerry"] output: "Tom,Jerry" Explanation: ANSWER ignored (queue is empty) Tom enters → [Tom] Jerry enters → [Tom, Jerry]
input: ["CALL Anna", "ANSWER", "ANSWER"] output: "EMPTY" Explanation: Anna enters → [Anna] ANSWER → Anna removed → [] ANSWER ignored → []
input: ["CALL Eve", "CALL Adam", "CALL Sam", "ANSWER", "ANSWER"] output: "Sam" Explanation: Eve enters → [Eve] Adam enters → [Eve, Adam] Sam enters → [Eve, Adam, Sam] ANSWER → Eve removed → [Adam, Sam] ANSWER → Adam removed → [Sam]