Probably, you have heard these problems already but I couldn't find any solutions. If any one can provide an answer to this, that'll be great.
Prob 1) 100 programmers turn up for an interview and the interviewer decides to select or reject a guy based on the interviews of that guy and all the previous guys. Only one programmer will be selected. There's not enough time to interview all the programmer. What strategy should the interviewer adopt to maximize the rank the programmer he selects? Prob 2) There are 'n' people. There is only one celebrity among them whom everyone knows. You need to find this celebrity in as many few calls as possible to function knows(Person p, Person q). What is the complexity? Prob 3) There is an array of unsorted random but distinct integers. How can we find a pair of elements the difference of which is the minimum possible in linear time. eg: A={1,3,8,-10,0,7} -> pair= {7,8} or {0,1} Thanks