Northrop Grumman Interview Question

Write a function that finds a number in an array that does not have a duplicate. For example [2,5,8,3,8,2,5] - > the answer would be 3.

Interview Answer

Anonymous

Apr 30, 2016

Sort the array first (complexity n log(n) ) and then pick out the non duplicate (complexity n). So the overall complexity is n log(n). You cannot do better than that.