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.
With replacement:
- nitish1024 April 07, 2018We need to find E(X) where X is event where I pick a number m <=n and draw a number from Hat k then k < m.
Let's p = P(I pick a number m <=n and draw a number from Hat k then k < m ).
E(X) = p*(1 + 0{As we have already reached success in the first step})+ (1-p){probability of failuer} (1 + E(X) {As we need to repeat the step again} )
i.e. E(X) = 1/p .
Now, we need to find the value of p where p = P(I pick a number m <=n and draw a number from Hat k then k < m ).
let's say A is event of picking a random number m <= n
And, B is a event of drawing a number k from Hat which is lesser than m.
We can calculate p by adding all possibilities of success, i.e. picking 1, and drawing < 1, or picking 2 and drawing < 2 or picking 3 and drawing < 3 ......... or picking n and drawing < n
P( Picking a number m from 1 to n ) = 1/n
P( drawing a number from hat < m) = m-1/n
Therefore,
p = 1/n*( (1-1)/n) + 1/n*((2-1)/n) + 1/n*((3-1)/n) + ...... + 1/n*((n-1)/n)
p =1/n^2 * ( 0 + 1 + 2 + 3 ......... + n-1) = n(n-1)/2n^2 = (n-1)/2n
And hence E(X) = 1/p = 2n/(n-1)