Amazon interview question

How would you remove common elements from a two arrays.

Interview Answer

Anonymous

May 19, 2012

input: array1, array2 output: array3, array4 make a hashmap load array2 into the hashmap iterate over array1, elements that are not in the hashmap are added to array3 make a hashmap load array1 into the hashmap iterate over array2, elements that are not in the hashmap are added to array4