Skip to main content
Posts
You are blindfolded and 10 coins are placed in front of you on the
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 tail 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 is how it can be done!
What was the task?
Without thinking too much we need to make 2 piles of 5 coins each. Now there are 3 possibilities here depending on number of heads in either pile. One of the pile might have either 0 or 1 or 2 heads (other having 5 or 4 or 3 heads).
Case 1 :
P1 : T T T T T
P2 : H H H H H
Case 2 :
P1 : H T T T T
P2 : H H H H T
Case 3 :
P1 : H H T T T
P2 : H H H T T
Now just flipping all the coins from single pile will make number of heads (or say tails) in both piles equal. So we can flip coins of either P1 or P2. Let's flip all coins of P2.
Case 1 :
P1 : T T T T T Number of heads - 0
P2 : T T T T T Number of heads - 0
Case 2 :
P1 : H T T T T Number of heads - 1
P2 : T T T T H Number of heads - 1
Case 3 :
P1 : H H T T T Number of heads - 2
P2 : T T T H H Number of heads - 2
You are given a unlimited number of coins and 10 pouches. Now, you have to
divide these coins in the given pouches in a manner that if someone asks
you for any number of coins between 1 to 1000, you should be able to give
the amount by just giving the pouches. You are not allowed to open
pouches for that.
How will you do it?
Know here the only efficient way to do that!
Source
What was the challenge?
Once again here binary number system comes in handy. Similar kind of use of binary system in day to day life is here! Another intelligent use is here! We are already provided 10 pouches which is exactly equal to the number of bits required to represent any number from 1 to 1000. Let's number the pouch as Pouch 0 to Pouch 9. So we need to group coins in 10 pouches like below.
Pouch 0 : 1
Pouch 1 : 2
Pouch 2 : 4
Pouch 3 : 8
Pouch 4 : 16
Pouch 5 : 32
Pouch 6 : 64
Pouch 7 : 128
Pouch 8 : 256
Pouch 9 : 512
Now if somebody asks us for 30 coins then we should give Pouch 4, Pouch 3, Pouch 2, Pouch 1. (11110) That's the binary representation of 30 if we assume Pouches as a bits. If another asks for 828 (binary - 1100111100) then we should give Pouch 9, Pouch 8, Pouch 5, Pouch 4, Pouch 3,
Pouch 2.