In this series I will be attempting to answer current and retried Google interview questions. As outlined in the books How Google Works and Work Rules! Google has found that “boring,” non-riddle questions are best at predicting future performance, but some of the older questions I’ll be answering are riddles.
You are at a party with a friend and 10 people are present (including you and the friend). Your friend makes you a wager that for every person you find who has the same birthday as you, you get $1; for every person he finds who does not have the same birthday as you, he gets $2. Would you accept the wager?
(1) Trick question, the only parties I go to are ten-way birthday celebrations. I get $9 total.
(2) “Bob, I’ve been meaning to talk to you about your gambling addiction. Even at this glorious party you’re making bets. Bob, don’t you see? This isn’t a party at all, it’s an intervention.”
(3) If you’re familiar with the “birthday problem” which is a popular problem given in probability classes, you’ll know that it takes 23 people to have a 50-50 chance of two people sharing a birthday. (The usual purpose of the exercise is to surprise people with the low figure of 23 people, which is unintuitive for most). So with 23 people the expected value of the bet is ($1*1 person -$2*21 people)*50% – ($2*22 people)*50% or a $42.50 loss for you. There are even fewer people at this party. The chance that any two people among 10 people will share a birthday is only 11.7% (1- 365!/((365-10)! * 365^10)). Since we would expect to lose money in the case with 23 people, we would definitely expect to lose money in the case of only 10 people. (This assumes it’s possible your friend has the same birthday as you, otherwise the chances diminish further).