CodePark/ problems / Support ticket queue
START PRACTICINGPRACTICE
Coding problem · Practical class design › Sorting, ranking and priority

Support ticket queue

mediumabout 35 minutes in an interview

A support desk hands out tickets to agents. Build a TicketQueue class.

new TicketQueue() starts with no tickets. Each ticket has a string id and a priority: "high", "normal" or "low". A ticket is open from when it's created until an agent takes it or it's closed.

Input: q.open("t1", "low"); q.open("t2", "high"); q.open("t3", "high") [q.take("ana"), q.take("ana"), q.take("ana")] Output: ["t2", "t3", "t1"]t2 and t3 are both high. t2 was opened first.

It comes in 3 parts, each building on the last: Next ticket, Escalate and close, Agent stats.