Pergunta de entrevista da empresa X

Coding question that required use of hash maps, and some follow-ups.