Pergunta de entrevista da empresa Compass

Round 1: Data Structure question, related to using Maps and Sets constructing the right output