*Welcome to techInterview, a site for technical interview questions, brain teasers, puzzles, quizzles (whatever the heck those are) and other things that make you think!*

I offer to play a card game with you using a normal deck of 52 cards. the rules of the game are that we will turn over two cards at a time. if the cards are both black, they go into my pile. if they are both red, they go into your pile. if there is one red and one black, they go into the discard pile.

We repeat the two card flipping until we’ve gone through all 52 cards. whoever has more cards in their pile at the end wins. i win if there is a tie. if you win, i pay you a dollar. how much would you pay to play this game?

### Solution

I wouldn’t give you a penny for that game. Here’s why.

Let’s say all the color pairs are matched. That means 13 red pairs, 13 black pairs, you win.

Now let’s say there is 12 red pairs in the deck, we pick them all from the top of the deck. With the 28 remaining card, there will always be exactly 12 black pairs and two mixed pairs. Why? Two red cards in the stack, they can’t be in a pair, otherwise you would get a total of 13 pairs, and I would too since all the black cards would be together. So the two red cards are matched with one black card each, leaving 24 black cards together, I get the same number of pairs as you do and you win.

Same math with 11 red pairs. That means four red cards in mixed pairs, hence 22 black cards left together, or 11 pairs.

No matter how mixed up the cards are, it’s a tie, and you win. Hence, I wouldn’t give you a penny.