# Interview puzzle with a deck of cards, some cards upside-down

You are sitting in a dark room. It is completely dark. You can't see anything and there is no way that you can make light. Basically, just assume that you are blind for this task.

There is a table in front of you and you feel a deck of cards in your hand. Now the deck is shuffled. But not only shuffled, 18 cards out of the 53 are right-side up and the rest are upside down.

Your task is to separate the deck into 2 piles, which have the same number of right-side up cards.

How would you do it?

-
An unrelated question, but why are there 53 cards rather than the standard 52? – jesterII Jul 28 '14 at 15:24
:) We have a "joker" card! – Saurabh Raje Jul 28 '14 at 15:25
Joke Answer: Rip each card in two and place each half in opposite piles. – PVAL Jul 28 '14 at 15:27
Dear @SaurabhRaje : It is not nitpicking: it's possible that the number of cards plays some sort of role. It might not matter, but for those of us who don't know the answer offhand we need to be sure you're clear. – rschwieb Jul 28 '14 at 15:30
I am (or at least once was) quite capable of detecting a card's orientation by feel alone. – Joshua Jul 28 '14 at 16:44

This is a classic question.

Split the cards into two piles. The first pile has 18 cards, the second pile has the remaining 35 cards. Say that there are $n$ upside down cards in the first pile, and therefore $18-n$ upside-down cards in the second pile.

Now turn over all the cards in the first pile.

-
then what? I am still left with some upside down ones? – Saurabh Raje Jul 28 '14 at 15:32
@SaurabhRaje It sounds like you haven't computed how many cards remain upside down in both piles at the end of this process. – rschwieb Jul 28 '14 at 15:34
Oh sorry, I got it now, thanks! I misinterpreted the question, sorry. – Saurabh Raje Jul 28 '14 at 15:40

This is an old puzzle, basically you take any set of 18 cards and turn them over. It should be the duplicate of some other question here.

-
I don't understand, how will it make all the cards face up? – Saurabh Raje Jul 28 '14 at 15:31
I think this is equivalent to what Chris is saying, although Chris wrote a little more. – rschwieb Jul 28 '14 at 15:33
The task is to have two piles, each with same number of upside cards. You don't have to make them all face up. Suppose the pile of 18 you picked initially had x cards. Then the other pile had 18-x cards. After flipping over these 18 cards, the x that were face up are now face down while the other 18-x in this pile are now face up. – Wonder Jul 28 '14 at 15:34
rscwieb yes, and his explanation is very clear. I would not have bothered to answer if he had answered before me. – Wonder Jul 28 '14 at 15:35
@Wonder Is that a duplicate or not? – user126154 Jul 28 '14 at 15:39