## Interview Question

Quantitative Researcher InterviewNew York, NY

Jane Street## You have two decks of cards: a 52 card deck (26 black, 26 red) and a 26 card deck (13 black, 13 red). You randomly draw two cards and win if both are the same color. Which deck would you prefer? What if the 26 card deck was randomly drawn from the 52 card deck? Which deck would you prefer then?

AnswerAdd Tags

## Interview Answers

11 Answers

▲

4

▼

Actually I think the third deck is better than the first deck. That is because it says to "draw two cards of the same color" not "draw two black cards". Compare the following decks: a deck with 13 black and 13 red, a deck with 26 black, and a deck with 26 red. The chance of drawing two of the same color cards are 6/25, 1, 1 respectively. You can see with a little math that any distribution of 26 cards is better than or equally as good as a distribution of 13 red and 13 black cards.

curious_cat on

▲

3

▼

the 3rd deck is the same as the 1st deck we do not need to calculate it by hand P(I randomly pick 2 cards in a 52 deck) = P(I always pick 2 cards on the top of the 52 cards’ deck) = P(You shuffle the deck, then I pick 2 cards on the top) = P(You shuffle the deck, you throw away the bottom half deck, then I pick 2 cards on the top) = P(Picking a 26 cards’ random deck, then I pick 2 cards on the top) = P(Picking a 26 cards’ random deck, then I randomly choose 2 cards in the 26 cards deck)

summer zheng on

▲

2

▼

The 3rd deck is better. Suppose the 3rd deck has k red cards. The probability of getting 2 cards of the same colour is (C(k,2) + C(26-k,2))/C(26,2). It is easy to see that this is minimum for k = 13, which is the first deck. So essentially any random 26 cards is at-least as good as a 13-13 split.

Ted on

▲

4

▼

1) P(win | 52-card deck) = 25/51. P(win | even 26-card deck) = 12/25. 52-card deck is better. 2) P(win | n-red cards in random 26-card deck) = (n/26 * ((n-1) / 25)) + ((26-n) / 26 * ((26-n-1) / 25)) = (n^2) / 325 - (2n / 25) + 1. Taking the derivative and solving for the root: P' = 2n / 325 - 2 / 25 = 0 -> n = 13, which is a minimum. Interpretation: having equal numbers of red and black cards in the deck MINIMIZES your chances of winning. Because the last deck is the same as the second deck (26 cards, split evenly red/black) except it may have an uneven number, this last (randomly selected) deck is better than the evely-split deck, but is it better than the 52-card deck? For this, we use the Hypergeometric Distribution (like the Binomial distribution, but for trials without replacement) to look at the odds of getting a 26-card deck with n red cards: P(selecting n red cards for random 26-card deck) = [ (52-26) C (26-n) ] * [ 26 C n ] / [52 C 26] = (2^43 * 3^17 * 5^12 * 7^4 * 11^4 * 13^4 * 17 * 19^2 * 23^2) / (29 * 31 * 37 * 41 * 43 * 47 * (n!)^2 * ((26-n)!)^2). From here, all that's left to do is combine these probabilities with the probability of winning [from above, P(win | n-red cards in deck) = (n^2) / 325 - (2n / 25) + 1] with each deck that contains 0 through 26 red cards (n => {0,26}). If this is larger than 25/51, then we can say definitively that we would prefer the randomly selected 26-card deck to the even 52-card deck. However, doing this out reveals that the probability of winning with the randomly selected deck = 25/51. Therefore, odds of winning are THE SAME with either the first (even 52-card deck) or the last (26-card deck, randomly selected from an even 52-card deck). Imagine, all that math to prove a simple equality! :) Q.E.D.

Anonymous on

▲

1

▼

These answers are all overkill, the answers are obvious by intuition which are good enough (perhaps even better) for an interview. 1. Obviously deck 1 is better , because taking away your first card has a smaller impact on the ratio of cards left of the same colour. 2. Obviously they're the same. Deck 1 is equivalent to shuffling a deck and taking the top 2 cards, Deck 3 is equivalent to shuffling a deck, taking the top 13 cards of that and then taking the top 2 cards of that.

Anonymous on

▲

0

▼

Split a blind draw into two draws doesnt change your distribution.

Stupidality on

▲

0

▼

For the second part, the decks are the same. It is easy to think about this using conditional probability. Picking from the 52 deck gives probability 25/51 of winning. Now consider drawing a deck of 26 cards from the 52 deck, and let (x,y) be (first pick, second pick). Then p(x) = p(x in 26 deck). p(x | x in 26 deck) = (1/2)*(1/26) = 1/52 p(y | x) = p(y in 26 deck | x) p(y | x, y in 26 deck) = (25/51)*(1/25) = 1/51 and p(x,y) = p(x)p(y|x) = 1/(52*51). Now probability of first red and second red is sum over all x and y red and where x and y are distinct. There are 26*25 such possibilities (order matters). Then p(both red or both black) = p(both red) + p(both black) = 2 * 26*25/(52*51) = 25/51 which is the same as for the 52 deck case.

Anonymous on

▲

0

▼

in this logic - even if you only pick a 4 cards' deck randomly from the 52 cards deck for me to choose 2 cards - it's the same probability as if I choose 2 randomly from the 52 cards' deck directly .

summer zheng on

▲

0

▼

@curious_cat I think that only implies that the third deck is better than the second deck (the second has 13/13 while the first has 26/26).

OP on

▲

2

▼

Just think of the third deck as the top half of the first deck, then you can see they're equally good

Anonymous on

▲

0

▼

I responded immediately to the first part. The second part took me a bit longer - I immediately said that my intuition thought the third deck and the first deck were equally good but couldn't give a good rigorous proof very quickly (took about 30 seconds or so).

Anonymous on

*One or more comments have been removed.Please see our Community Guidelines or Terms of Service for more information.*

## Add Answers or Comments

To comment on this, Sign In or Sign Up.