Grouping The Coins in Binary Numbers
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.
Comments
Post a Comment