Given an array of N integers, find the missing integer.
Respuestas de entrevistas
Anónimo
5 nov 2010
the answer is subtract the sum from n*(n+1)/2
3
Anónimo
20 mar 2011
Is that a well-known algorithm? I don't know how you could ever have figured that out. I would have sorted the array and iterated until I got to the missing integer.
Anónimo
13 may 2010
Iterate through array, keeping a sum of the values. Subtract the final answer from n*(n-1)/2