Hi pramod, The interviewer is making the selection, right? So what's this "maximize the rank of the person selected"?? There is no second round or interviewing mentioned, and so there is no need to maximize any rank for the person selected. If the interviewer likes Jatindar, he selects Jatindar, if he likes Susan best for the job, he selects Susan, and so on.
You are hiding something from me, in this problem. :-) Whether you mean to or not. And I certainly remain to be convinced how you could possibly "ignore" several of the applicants, and say that you actually made the "best" choice. Makes no sense to me. In #2, if everyone knows who the celebrity is, then one visit to the function will be enough, because the first person you meet will know who the celebrity is, so the function will return TRUE. Anybody OTHER THAN the celebrity (who you said was known to everyone), is a very different matter indeed. In #3, I believe you're way off. Take a large set of 30 numbers. Only a very few subsets will consist of just pairs of digits, and have to be compared. Of course, all subsets with pairs will still have to be generated and then compared, but that will be a small number of sets and comparisons to make, when compared to the whole number of possible combinations of 30 numbers, for instance. adak