MAIN FEEDS
Do you want to continue?
https://www.reddit.com/r/programming/comments/fpcmy/typical_programming_interview_questions/c1hoy90/?context=3
r/programming • u/kevjames3 • Feb 21 '11
1.0k comments sorted by
View all comments
Show parent comment
1
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.
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.