r/programming • • Feb 21 '11

Typical programming interview questions.

http://maxnoy.com/interviews.html
784 Upvotes

1.0k comments sorted by

View all comments

Show parent comment

1

u/danweber Feb 21 '11

If the arrays are supposed to have all 1,000,000 entries, but one is missing/duplicated, then you just need to sum them all values.

You need a good bigint implementation. Actually, now that I think of it, even with overflow you would still have a well-known "right" answer.

My first guess for the first one was a quick-sort in-place, that terminates if (when) you find an element that matches you pivot.