1000 Coins and 10 Bags | Interview Puzzles



How will u divide 1000 one Rs. Coins in ten bag so that u can give any amount between 1-1000 by just giving the bags without changing the no of coins in each bag.



Solution:

You set the no. of coins as powers of 2 except for the last bag where you just place whatever remains.
Bag 1 = 1 coin
Bag 2 = 2 coins
Bag 3 = 4 coins
Bag 4 = 8 coins
Bag 5= 16coins
Bag 6= 32coins
Bag 7=64 coins
Bag 8= 128 coins
Bag 9= 256 coins
Bag 10= 488 coins ( If the total no = 1024 coins this should be 512)

Now any number from 1 to 1000 could be obtained by combining these bags.
Notice bag #10 is a little short of 2*256, or 512. That's because you only have 1000 coins. The previous 9 bags have 511 coins in total, leaving only 489 for bag 10.

Anyway, you can dispense any amount of coins from 1 - 1000 by just choosing bags here.

Try any number: 617. Bag #10 + bag #8

Comments

  1. cotton bags
    The Simply magic canvas tote bag Bulk pack is manufactured with premium materials and is ideal for all types of uses! This large canvas bag is spacious, durable, useful, and stand upright. Grab it before you head to the library to carry your books home. Bring it with you to your local Superstore to pack your purchases. Use it to hold your picnic supplies on your next outing. Fill it with your towels, Sand toys, suntan lotion and other essentials for your next trip to the beach. Anytime, anywhere, This is the right bag for the job. Two sturdy handles make it easy to carry in your hand or over your shoulder. All seams are double stitched to handle your heavy purchases. As reliable as it is roomy, you’ll find yourself reaching for this bag again and again.

    ReplyDelete
  2. After a long time of searching for a recovery expert and platforms to help me recovering my funds, I finally meet a ethical hacker who helped me to recovery all i have lost to this broker site 24options worth $30 Thoushand USD, and I must say that he's a God sent, His help was quite outstanding from the handling of the case by the case manager to completion. I just want to say thank you onlineghosthacker247 for this rare opportunity to get my funds back when all hope seems lost due to the sea of scams out there. I totally recommed him and you can reach him on his email ( onlineghosthacker247 @ gmail . com) and thank me later .

    ReplyDelete

Post a Comment