Opening your workspace…
Workspace/Coding room
Opening your workspace…
Customers join a pickup line and are served in arrival order. Read events from left to right. A positive integer joins the back of the line with that ticket number. A zero asks the counter to serve the oldest waiting ticket. Return one number for every zero: the ticket served, or -1 if the line was empty. Repeated ticket numbers represent separate arrivals. Tickets still waiting after the last event do not appear in the answer.
[8,3,0,5,0,0]OUTPUT[8,3,5]Ticket 8 arrived first, followed by 3 and then 5. Each zero serves the oldest waiting ticket.
[0,4,0,0]OUTPUT[-1,4,-1]The line is empty for the first and last service commands. Ticket 4 is served by the middle one.
Tab inserts two spaces. Press Escape, then Tab, to leave the editor. Press Control or Command and Enter to submit.
[8,3,0,5,0,0][8,3,5]Public samples only. These checks do not award ranked points.
Walk through a solution, check its time and space costs, and compare it with yours.
Checking your progress…