HomeRun.com Interview Question
3 Interview Reviews |
Back to all HomeRun.com Interview Questions & Reviews
Interview questions and reviews posted anonymously by interview candidates
Interview Question for Senior Software Developer, Remote Position at HomeRun.com:
There is an array of numbers from 1 to N in random order. A random number was picked and taken out. Give an algorithm to determine which one.
See more for this HomeRun.com Senior Software Developer, Remote Position Interview
Helpful Question?
Yes |
No
Inappropriate?
0 of 0 people found this helpful
by Interview Candidate:
Answer 2: Scan through the array and convert each member into a key-value pair such as hash[n] = n. Then scan through 1..N keys to determine which one has a null value (or unassigned). Compared to the "aha" solution, this one is O(2n) but adding too many numbers could cause overflow if N is big enough.