- Joined
- 3/15/11
- Messages
- 19
- Points
- 13
From Andy's recently resurrected post "DE Shaw interview questions":
" 3. The integers from 1 to n are stored in an array in a random fashion. but one integer is missing. write a program to find the missing integer."
Let's make this a bit harder: suppose k numbers are missing, how do we identify them? The solution to the original problem adapts pretty easily to give an O(kn) algorithm but I'm wondering if there's anything faster/more elegant.
" 3. The integers from 1 to n are stored in an array in a random fashion. but one integer is missing. write a program to find the missing integer."
Let's make this a bit harder: suppose k numbers are missing, how do we identify them? The solution to the original problem adapts pretty easily to give an O(kn) algorithm but I'm wondering if there's anything faster/more elegant.