Pocket Gems Interview Question: Given two arrays of integers,... | Glassdoor

Interview Question

Software Engineer Interview San Francisco, CA

Given two arrays of integers, find which number is present

  in the first array but not present in the second array.
Answer

Interview Answer

3 Answers

0

Make the second array a hash map n insert elements of first array into it.
The element left over is the one not present in second array.

(Given the array size is small)

Anonymous on Sep 28, 2012
0

I would sort the arrays first,
once you got something like this:

[1,1,1,2,3,4]
[1,2,2,5,6,7]

things gotten simple

Anonymous on Oct 24, 2012
0

Do you have a question about Pocket Gems? Don't ask just anyone for information, ask an employee from Pocket Gems. They're all waiting at Rooftop Slushie.

https://wwww.rooftopslushie.com

Anonymous on Jul 15, 2019

Add Answers or Comments

To comment on this, Sign In or Sign Up.