Questions (1)

Comments (1)

Reputation 50

is a comprehensive book on getting a job at a top tech company, while focuses on dev interviews and does this for PMs.

CareerCup's interview videos give you a real-life look at technical interviews. In these unscripted videos, watch how other candidates handle tough questions and how the interviewer thinks about their performance.

Most engineers make critical mistakes on their resumes -- we can fix your resume with our custom resume review service. And, we use fellow engineers as our resume reviewers, so you can be sure that we "get" what you're saying.

Our Mock Interviews will be conducted "in character" just like a real interview, and can focus on whatever topics you want. All our interviewers have worked for Microsoft, Google or Amazon, you know you'll get a true-to-life experience.

I have solved this problem partially but I am unable to continue at this point:

- shravya.nitk August 22, 2013case 1:

There are 2 approaches: logical and recursive.

if you pick a number i, to find a number smaller than the one you have is:

Exp(num<i)=1*(i-1)/(n-1)+2*(n-i)(i-1)/(n-1)^2+3*(n-i)^2(i-1)/(n-1)^3.......

which reduces to Exp(num<i)=(n-1)/(n-i)

Also, recursively

E(i)=1*(i-1)/(n-1)+(E(i)+1)*(n-i)/(n-1)

when you solve it, u get

E(i)=(n-1)/(n-i)

Now, this is where i get stuck.

to find final expectation value

E=sum(E(i)) where i=1:n =infinite :/

and if u exclude the case of picking up 1, u get a harmonic sum. so, what do i do next?

case 2:

this doesn't lead to infinite but it poses a logical question: you know that if u pick the number 1, even if we look through the remaining n-1 chits, there is nothing u can find smaller than 1. so it's a failure. meaning u never find it, not... u find it after n-1, so we can't assume it as any number....

so what do i do for that??

Continuing, if i exclude 1 and try to solve logically, cause the recursion formula i couldn't get

if u pick

n -> 1

n-1 -> 1*(n-2)/(n-1)+2*1/n-1

n-2 -> 1*(n-3)/(n-1)+2*2/(n-1)(n-2)

and so on

2 -> 1*1/(n-1)+2*(n-2)*1/(n-1)(n-2)+3*(n-2)(n-3)*1/(n-1)(n-2)(n-3)+.......

how do i simply it?