Millennial Media Interview Question: Given a list of integers how ... | Glassdoor

Interview Question

Software Engineering Interview Boston, MA

Given a list of integers how would you implement an

  efficient method to figure if there are duplicates?
Answer

Interview Answer

2 Answers

0

Sort the list and search side-by-side for duplicates ( O nlog(n) )

Interview Candidate on May 14, 2015
0

Instead how about adding all elements in a hash-map as key and value 1 in the beginning and increment for every duplicate O(n) and then picking up the hashmap key with value > 1 which O(1)

Answer on Feb 1, 2016

Add Answers or Comments

To comment on this, Sign In or Sign Up.