employer cover photo
employer logo
employer logo

Knight Capital

Acquired by KCG

Is this your company?

Knight Capital interview question

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

Interview Answers

Anonymous

5 Nov 2010

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

3

Anonymous

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.

Anonymous

13 May 2010

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

2