Sollicitatievraag bij Knight Capital

Given an array of N integers, find the missing integer.

Antwoorden op sollicitatievragen

Anoniem

5 nov 2010

the answer is subtract the sum from n*(n+1)/2

3

Anoniem

20 mrt 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.

Anoniem

13 mei 2010

Iterate through array, keeping a sum of the values. Subtract the final answer from n*(n-1)/2

2