Microsoft

www.microsoft.com
Employer Engaged

Interview Question

Program Manager Internship Interview(Student Candidate) Redmond, WA

Problem: Array of 100 integers between 0 and 100. One

  integer is doubled, find out which. Question: Which methods exist and how do they compare?
Answer

Interview Answer

2 Answers

0

The worst answer in this case is an algorithm, the interviewer clearly did not ask for that. An important question to ask is whether they want the Position of the doubled integer or only its value. Possible solutions: sort (quick sort, radix-sort/K-sort), search, counting, Polynom, a[0]+a[1]+...a[101] - 0+1+2+99+100 = doubled integer.

Interview Candidate on Jul 23, 2013
0

sum on N numbers in (N*N+1)/2. Add all the numbers and find out how much it differs from this sum

Anonymous on Jul 25, 2013

Add Answers or Comments

To comment on this, Sign In or Sign Up.