How do you split coins to match heads?
BnpData Scientist · Technical ScreenLast updated
This question evaluates logical reasoning about invariants and combinatorial parity, testing the candidate's ability to design deterministic strategies under partial information; it falls under Software Engineering Fundamentals with relevance to probability and discrete mathematics for a Data Scientist role.
There are N coins on a table. You are told that exactly H of them are heads-up (you do not know which ones). You must split the coins into two piles so that the number of heads-up coins is the same in both piles. You are allowed to flip any coins you choose.
Describe a strategy that always works and justify why it works.
Solution walkthrough is for members
Get the full walkthrough with reference code and complexity analysis, plus Kitty Coach at 300 messages a day. Hints, the code runner and community answers stay free.