Interview Question

Senior Data Scientist Interview

-San Carlos, CA


Imagine you have N pieces of rope in a bucket. You reach in and grab one end-piece, then reach in and grab another end-piece, and tie those two together. What is the expected value of the number of loops in the bucket?

AnswerAdd Tags

Interview Answers

3 Answers


Is the question and answer makes sense? I thought the answer is 1/(2n-1). I don't understand why the solution adds all probability from 1 to N case together? For the 2 ropes case, the p(1 loop) = 1/3. So expected number of loop is also 1/3, but why the answer is 1+1/3= 4/3?Am I missing something?

jabberwky on


You are right, the long answer failed simple boundary condition: if you tie once after pick two end, the max number of loops is one! So the p(n) is [0,1], lol

Anonymous on


I got the correct answer, but the mathematician yelled at me for arriving to slowly at such an "easy" answer.

Anonymous on

Add Answers or Comments

To comment on this, Sign In or Sign Up.