Pergunta de entrevista da empresa TradingHub

Graph-based problem, as far as I can recall.