Microsoft Interview Question: given an array with N element... | Glassdoor

Interview Question

Engineer Interview Hyderabad (India)

given an array with N elements (~ 2n+1), which contains

  positive integers. All the numbers are repeating (i.e. they exist in pairs) except one. Find the non-repeating number.

Interview Answer

1 Answer


an xor (exclusive OR) of all the numbers will return the number repeating only once.

Aditya on Aug 1, 2011

Add Answers or Comments

To comment on this, Sign In or Sign Up.