Pergunta de entrevista da empresa Amazon

Given two arrays with numbers, to return an array containing only those numbers occurring in both the arrays

Resposta da entrevista

Sigiloso

30 de nov. de 2012

Create a hashtable of the first array with the array value being the key and the hashtable value being a counter (set each value to 0). Walk through the second array and check if it exists in the hashtable, if it does, add it to the return array.