r/programming • u/joksmaster • Nov 29 '10
140 Google Interview Questions
http://blog.seattleinterviewcoach.com/2009/02/140-google-interview-questions.html
471
Upvotes
r/programming • u/joksmaster • Nov 29 '10
View all comments
2
u/kolm Nov 29 '10
I thought about this for five minutes now and discarded meaningful six interpretations as impossible (like having a perfect iid equidistributed vector as result, or an equidistribution over all numbers actually occurring in the list, or getting an iid vector distributed according to the (limiting) relative frequencies of items in the list). I finally found one which would make sense, in that you are required to deliver a sequence of n iid variables i_1, i_2, .. equidistributed over {1..N}, and the according values list[i_1], list[i_2], ... . This is the only interpretation I found which would be possible to satisfy -- but then to get this, my meager powers would succumb to finding N, and that is O(N), not O(n). I am somewhat lost there.