Goldman Sachs

  www.goldmansachs.com
Work in HR? Unlock Free Profile

Goldman Sachs New Associate Programmer Analyst Interview Question (student candidate)

I interviewed in Salt Lake City, UT and was asked:
"Implement an intersection method for two lists. After showing a brute force method, I was asked to improve upon the method and analyze time complexity for both algorithms."
Tags: algorithm
Add Tags [?]
Answer

Part of a New Associate Programmer Analyst Interview Review - one of 1,566 Goldman Sachs Interview Reviews

Answers & Comments

2
of 2
votes
1. Traverse through the first list and put all items in a hash table.
2. Traverse through the second list and try to find these items in the hash table created in step 1 -> Add all items found to the intersection list.

O(N) complexity.
- Vinod on Nov 19, 2012

To comment on this question, Sign In with Facebook or Sign Up

Tags are like keywords that help categorize interview questions that have something in common.