Pergunta de entrevista da empresa WorkForce Software

Scan integer array for duplicates and return them.

Resposta da entrevista

Sigiloso

17 de mai. de 2022

Create HashSet, check if integer is already in set, if so it's a duplicate so add it to results array, if not add it to the set. One optimization I missed is you can just print the integer once by using a map where you flag the number if you've already printed it. That would be n time complexity, mine was technically 2n, but still just fine.