Goldman Sachs Interview Question: Given two arrays A and B, fin... | Glassdoor

Interview Question

Summer Analyst Interview New York, NY

Given two arrays A and B, find the difference and

  intersection of the two.
technical, analytical, algorithm, hash, array

Interview Answer

1 Answer


I first approached with with a search and sort algorithm. B would be sorted with some nlogn algorithm, then we can iterate through A and conduct a binary search on B to find matching items. This does not give the difference. I later came to the solution of hash tables, which was the best solution.

Interview Candidate on Feb 16, 2013

Add Answers or Comments

To comment on this, Sign In or Sign Up.