Logic puzzle, generic form

658 Views Asked by At

This logic puzzle has stumped me for some time now:

You are in a dark room with a deck of cards in front of you. 30 cards are face down and the rest are face up. How can you separate the cards into two piles such that each pile has the same number of face-up cards? You are allowed to turn over any amount of cards, but it is too dark to see.

Can this be solved generically for any number of face-up and face-down cards?

2

There are 2 best solutions below

0
On

Hint: It can be solved for any number of face-up cards, as long as you know how many there are.

2
On

We don't know how big to make the piles. The only number given in the problem is $30$, so let's try tha‌t: suppose we make a pile with $30$ cards (w‌ithout turning over any card yet). It will have some number of face-down cards, say $k$, and the rest of the cards ($30-k$ of them) will be face-up.

The other pile has the remaining cards. This includes the rest of the original face-down cards‌ (there were $30$ total, and some number $k$ are in the first-pile, so there are $30-k$ here), and some unknown number of face-up cards.

To summarize:‌ the first pile has $k$ face-down cards and $30-k$ face-up cards; the second pile has $30-k$ face-down cards and some number of face-up cards.

Now we want to make the number of face-up cards equal in the two piles. I‌t should be obvious how to achieve that from here. ‌:-)


So yes, the problem can be solved for any number of face-down cards in place of $30$, provided we are told what the number is.‌ We don't need to be told what the number of face-up cards is.