9 N COINS FLIP
You have an N coins laying flat on a table, each with a head side and a tail side. M of them are heads up, rest are tails up. You can’t feel, see or in any other way find out which M are heads up. Your goal: split the coins into two piles so there are the same numbers of heads-up coins in each pile.
Write a code.