You are having $302 with you. Divide $302 (in whole $ increments)
into a number of bags so that I can ask for any amount between
$1 and $302, and you can give me the proper amount by giving me
a certain number of these bags without opening them. What is the
minimum number of bags you will require?
7 comments:
10....very easy question
Er...no.
8 bags is sufficient to measure out any amount up to $255 in $1 increments. The 8 bags contain $1, 2, 4, 8, 16, 32, 64, & 128. The remaining $47 simply goes in a 9th bag.
So 9 bags is the answer.
9 bag is sufficient
we see the bag contains no of amount is:$1,$2,$4,$8,$16,$32,$64,$125,$256
@Imran
Your bags add to more than $302.
it's nine! just do the math yourself.
Total 18 bags required.
1+2+4+8+16+32+64+128 = 255 (8 bags)
1+2+4+8+16 = 31 (5 bags)
1+2+4+8 = 15 (4 bags)
1 = 1 (1 bag)
----- ---
302 coins 18 bags
Post a Comment