LET'S TALK TECHNICAL

This blog is intended to help people prepare for the job interviews and improve their analytical skills. We have posted difficult datastructures and algorithm questions and puzzles. Interview experiences section is for the people to post their interview experiences.Views expressed here are of their personal and the blog author doesn't take any responsibility for the same.

-

Followers

Jobs

Sunday, November 21, 2010

100 coins dividing into equal heads groups.

Question:
You have 100 coins, 37 of them are heads, rest are tails. Your task is to divide this 100 coins into two groups in which there will be the same number of heads. You are blindfolded and you can flip any number of coins.

Solution:
Pick any 37 coins and flip all of them.

Explanation:
 Lets take a simple case where 5 coins with 3 heads and 2 tails.
HTHHT
Lets take 3 coins randomly. Say first,fouth and fifth lets call it S1. Let remaining coins be S2. So we have 2 groups now
S1(H,H,T) and S2(T,H)
When we flip  the selected set S1 it turns into S1F(T,T,H).  We have only one head in both the sets.

4 comments:

  1. If u have 5 coins and 4 heads ur sample does not work.
    S1 = HHH S2 = TH
    Flip 4 and u either have no heads, or u have 2 heads in S2 and none in S1

    ReplyDelete
  2. Your division is wrong. You cannot pick 3 and 2 coins. You have to pick any 4 coins as you have 4 heads. Please read my solution again.

    ReplyDelete
  3. What is the idea behind this?

    ReplyDelete
  4. Can u plz explain this? If i flip 1st 2 coins in s1 and and 1st coin of s2, s1 contains no heads and s2 contains 2?

    ReplyDelete

Popular Posts