Eze Software Interview Question: You are in a dark room with ... | Glassdoor

Interview Question

Quality Assurance Interview Boston, MA

You are in a dark room with no light . You need matching

  socks for your interview and you have 19 grey socks ans 25 black socks. What are the chances you will get a matching pair?

Interview Answer

21 Answers


It would be 1- (prob of getting both greys + prob of getting both blacks)
prob of getting both greys = 19/44 * 18/43 = 342/1892
prob of getting both blacks = 25/44 * 24*43 = 600/1892
Probability of getting a pair = 1- ((342+600)/1892) = 950/1892

SC on Mar 23, 2010

You could give the precise answer as above (be SC) or, more simply, you could tell them you grab three socks as two of them will match for sure.

CL on Dec 30, 2010

actually if you pulled out three socks there is still a chance you could get all grey or all black..

tara on Dec 30, 2010

For me, there is NO chance that I will get a non-matched pair.

I don't know about you, but I keep my socks bundled together as a pair in my drawer.

Therefore, when I pull out a pair of socks, even in the dark, I am CERTAIN that they are matching.

The problem had 19 grey & 25 black, meaning there will be 1 individual left from each color. If I felt individual socks in the dark instead of a bundled pair, I would not pick those.

Which means I would always have a matched pair.

MarkK on Dec 30, 2010

This is fairly simple. You need to pick 3 socks as stated above to be sure of a match. So after picking the first sock, its a 50-50 shot the second will be a match.

jcc5018 on Dec 30, 2010

There is no stipulation to choose only two socks. If you pick three then you will have a pair in there somehwere; even if you have three-of-a-kind, you can discard one to make a pair.

Stuart on Jan 4, 2011


Lynn on Jan 7, 2011

The problem with taking 3 socks is that the question clearly stipulates there is NO LIGHT.

Taking three socks is a novel idea but you would STILL not be able to judge the color of the socks without light. therefore you must follow the route laid out by the first poster, SC. (No need to repeat it)

Matt on Jan 11, 2011

According to Murphy's law, the chances are inversely proportional to the importance of the interview.

PF on Jan 11, 2011

how about, "uh oh..... you must be trying to tell me something."

pt on Jan 11, 2011

I'd just do one of three things. 1st turn on the light 2nd wear long pants so that my socks don't show or 3rd grab them all and find a matching pair wear its lighter

Anonymous on Jan 11, 2011

The answer is simple, I have black on the right side of the drawer and grey on the left side of the drawer. I reach to the side that has the color that I need...does this mean I am a little OCD? The answer is really good!

cm on Jan 11, 2011

I would choose no sock then just tell the interviewer that it's "very European" not to wear socks ... unless with sandals.

Maximus on Jan 11, 2011

SC calculated the correct probability of getting WRONG socks if allowed to ONLY take 2 single socks from a mix of 19 single grey and 25 single black socks. The correct calculation is 942/1892 is the actual chance of getting a pair of either colour (don't care if they match the suit - since I don't know what colour suit I'm wearing, as it's dark, just that they match each other). This is 49.7%. Since this is less than an even bet, it is probably time to look for a creative solution (after providing the correct answer of course).
I'm disappointed none of you checked the maths before providing the standard '3 socks make a pair' response - which I prefer anyway - or the selection of brilliant lateral thinking responses. (My wife kindly pairs my socks as I' colour blind anyway - so they always match each other - but seldom match my clothing.)
Tara has obviously not read the question - 3 grey or 3 black socks does provide a matching pair.
If I want a matching pair which ALSO matches my suit - then I need to be allowed more socks - 21 if I want a black pair, 27 if I want a grey pair - or of course 27 in the worst case if I don't know what suit I'm wearing, and it happens to be grey.

Mickey on Jan 11, 2011

Don't lose sight of the actual question. "What are the chances you'll get a matching pair"

First pick one sock, the color doesn't matter. Either Grey or Black.
Now when you pick the second sock there are only 2 colors so you have a "50/50 chance" that it will match the first one.

Thus answering the question "What are the chances......"

2easy on Jan 11, 2011

There are (25 choose 2) unique combinations of black + (19 choose 2) unique combinations of grey out of a total of ((25+19) choose 2) unique combinations.

25 choose 2 = 25! / (2! * (25 - 2)!) = 300
19 choose 2 = 19! / (2! * (19 - 2)!) = 171
44 choose 2 = 44! / (2! * (44 - 2)!) = 946

(300 + 171) / 946 = 0.4979 = 49.79% probability, same as concluded by Mickey's correction of SC.

Sorry 2easy, time to brush up on your probabilities.

Mike on Jan 11, 2011

One thing you can do with questions like this to either check your answer or to sometimes get the answer very quickly is to take the situation to the extreme.

In this case, doing so is a very easy way show 2easy that his solution isn't right. Here goes...

What if there were 200 billion gray socks and 2 black socks. What are the chances of picking 2 socks and getting a matching pair? Almost 100%, right? You'd have to be unlucky enough to pick one of the two black socks out of 200 billion in order to get a non matching pair. So the 50/50 solution clearly isn't right.

Steve on Jan 11, 2011

Pick one sock at random without looking. The chances of getting a gray sock are 19/44 on the first draw and 18/44 on the second. So the cumulative probability would be 0.431818 * 0.409091 = 0.176653.

The probability of picking a black sock on the first draw is 25/44 and 24/44 on the second. The probability of picking 2 black socks is 0.568182 * 0.545455 = 0.309917.

So the probability of picking a matching pair is 0.48657.

Bob InNorCal on Jan 12, 2011

seriously!! interviewer first checks the socks

asad on Mar 21, 2013

The first guy seems right, only that you don't need to do a (1 minus). You just need to add up the probabilities of both grays and both blacks.

Apple on Sep 16, 2015

My socks are in bundles, the odd single socks are spares from having lost the mates. Reaching in grab one bundle. The odds are in your favor of getting a pair. Don't over complicate it folks. Not bundling is a sign of not being much organized.

Sock Bundler on Apr 25, 2017

Add Answers or Comments

To comment on this, Sign In or Sign Up.