Pergunta de entrevista da empresa SIMON Markets

Standard data structures & algorithms question.