Qm
BrainteasersJane StreetOptiver

Splitting a deck in the dark

You are in a completely dark room with a deck of 52 cards. You are told that exactly 10 of them are face up and the rest face down, in unknown positions. You cannot see or feel which cards are face up.

Divide the deck into two piles so that each pile contains the same number of face-up cards. The piles need not be the same size, and you may turn cards over.

Show a hint

Take some number of cards off the top to form a pile. Whatever number of face-up cards it contains, the other pile contains 10 minus that many. What happens if you flip every card in your pile?

Your answer

Solving needs a free account

Answers, streaks and solutions unlock when you are signed in. Reading the question and the hint stays free.

Discussion

Sign in to join the discussion · reading is open to everyone

💡 Discussion rules

  1. No full solutions here. Hints and approaches only.
  2. Complexity, edge cases and intuition are the point.
  3. Interview experiences are welcome. Respect your NDAs.

Loading discussion…

Learn the concepts

The theory behind this question.

Related questions

The blind man and the four pillsThe bookworm and the ten volumesBorn on the same day, same parents, not twinsThe bridge with the sleepy guardEscaping a fire on a long thin island
All questions →