Opening your workspace…
Workspace/Coding room
Opening your workspace…
You're covering reception while Pam is out. Each incoming call asks for someone at the Scranton branch. If that person is on the phone, you put the caller on hold. Whenever someone finishes a call, you transfer the earliest caller waiting for them. Given the call log, return the names of the callers still on hold, in the order they called.
[["call","Jan","Michael"],["call","David Wallace","Michael"],["hangup","Michael"]]Output[]David Wallace waits while Michael talks to Jan. When Michael hangs up, you put David through.
[["call","Mose","Dwight"],["call","Carol","Michael"],["call","Angela","Dwight"],["call","Jan","Michael"],["call","Creed","Dwight"]]Output["Angela","Jan","Creed"]Dwight is talking to Mose and Michael is talking to Carol. Angela, Jan, and Creed are still waiting, in that order.
Give each employee a separate queue. Keep the arrival order when listing callers still waiting.
function solve(log) { // Write your solution here. }
Tab inserts two spaces. Shift+Tab outdents. Use the arrow keys and Tab to choose a suggestion. Press Escape, then Tab, to leave the editor. Press Control or Command with apostrophe to run samples or with Enter to submit.