Interview Question
Software Development Engineer In Test (SDET) Interview

WebtrendsI was asked a pretty straight forward brain teaser during my last phone interview, which they said they don't normally do, but because I put that I was a logical problem solver on my resume they couldn't resist the opportunity to. It was the following "There are 20 different socks of two types in a drawer in a completely dark room. What is the minimum number of socks you should grab to ensure you have a matching pair?"
Interview Answers
13 Answers
All of the previous answers are somehow wrong or misleading. "Notamathematician": the method you describe would ensure that you get 2 DIFFERENT socks instead of matching  and only in the situation that the ratio is exactly 5050. "Anonymous on Oct 20 2012": No, you could also have 3 of the same sock after grabbing 3. "Anonymous on Oct 3": The probability has little to do here, while it is over 0%. THE REAL ANSWER: Given that there are 2 types, and you want to get a MATCHING PAIR (not 2 different socks) you must grab 3. When you have 3, you WILL have at least 2 of the same kind, since there are only 2 kinds available.
Martti on
1 black : 19 white. .. 3 socks 2 black : 18 white ... 3 socks 3 black : 18 white ... 3 socks 4 black : 16 white.. . 3 socks 5 black : 15 white .. . 3 socks 6 black : 14 white ... 3 socks . .. . .3 socks. why? The worst case scenario is always 2 of one color and one of the other.
DanS on
I'm not a mathematician, statistician or highly analytical but if you pick up 3 socks they could still be all the same type  even if the odds are 50%. Odds do not equal reality. So the only way to "ensure you have a matching pair"is to pick up 11 of the 20. This is the only fool proof guaranteed way to get a pair (in the real world and not the world of odds).
Anonymous on
It says "ensure" you have a pair. So all the probability answers are dead wrong. The person who said "The answer is none. There is no sock alike, so you can't get a pair" is probably correct. However if the question is to get two of the same type (of which there are two), then the only correct answer is 11. That is the MINIMUM number to ENSURE you have a pairall probability aside.
Ariel Balter on
It says "ensure" you have a pair. So all the probability answers are dead wrong. The person who said "The answer is none. There is no sock alike, so you can't get a pair" is probably correct. However if the question is to get two of the same type (of which there are two), then the only correct answer is 11. That is the MINIMUM number to ENSURE you have a pairall probability aside.
Ariel Balter on
It doesn't tell you that there are 10 and 10. There could be 19 and 1. But regardless: There IS a way to grab 2 socks and not have 2 that match. (one of each) But there is NO WAY to grab three socks and not have 2 of them match.
Joe Sessions on
Actually, the worst case scenario is you could pick 19 socks and still have ALL the same color if only one is a different color. My solution is "Turn on the light".
David Lewis on
It also does not say the two types of socks are evenly divided in the drawer :)
ME on
"I'm not a mathematician, statistician or highly analytical but if you pick up 3 socks they could still be all the same type  even if the odds are 50%. Odds do not equal reality. So the only way to "ensure you have a matching pair"is to pick up 11 of the 20. This is the only fool proof guaranteed way to get a pair (in the real world and not the world of odds)." Doesn't "same type" = "matching pair"? So it would be 3
Anonymous on
Easy. I do this every morning when I get up. The answer is ONE PAIR. If you are like most people and have rolled the socks together in pairs when you put them away, there is no guessing and you just grab a pair of socks. I think it's more of a question about habits and prep. ;)
Jeremy on
3 is the answer when the probability is 50% for either color.
Anonymous on
"20 DIFFERENT socks of two type" In my opinion It's a brain teaser not a probability question. The answer is none. There is no sock alike, so you can't get a pair.
Anonymous on
3 is the answer no matter what... there are only 2 types, if you grab 3, you must have 1 of one type and 2 of the other
Anonymous on