**Problem:** You are blindfolded and 10 coins are place in front of you on table. You are allowed to touch the coins, but can’t tell which way up they are by feel. You are told that there are 5 coins head up, and 5 coins tails up but not which ones are which. How do you make two piles of coins each with the same number of heads up? You can flip the coins any number of times.

This puzzle was asked in **Yahoo Interview**.

**Solution:**

Make 2 piles with equal number of coins. Now, flip all the coins in one of the pile.

How this will work? lets take an example.

So initially there are 5 heads, so suppose you divide it in 2 piles.

Case:

*P1 : H H T T T P2 : H H H T T*

Now when P1 will be flipped

P1 : T T H H H

P1(Heads) = P2(Heads)

Another case:

*P1 : H T T T T P2 : H H H H T*

Now when P1 will be flipped

P1 : H H H H T

P1(Heads) = P2(Heads)

That time head count is zero that is also valid answer

What if first pile has 3 heads and 2 tails and second pile has vice versa!

Still the same

it still works. whats the problem

You can also flip them all over to the same side but two and then separate the coins into two equal piles splitting the two odd sided coins, one in each pile. This too would ensure that the two piles have equal numbers of heads either 1 or 4.

Hello

what if first pile is made => H,H,H,H,H

second pile => T,T,T,T,T

If first pile is reversed, then first pile => T,T,T,T,T and second pile => T,T,T,T,T

There is no perfect answer to this question.

However worst case 2 questions can be asked to the person who sees the piles and confirmes if OK or not.

e.g if we replace first pile wrong then if we got the answer as wrong.

then we can reverse first pile as before and do the replacement of second one.

so 2 trials worst case.

What if the pile’s 1st order s set to- TTHTT

and the order one – HHTHH

then how it will be solved..