Ishita has 10 bags full of coins. Each bag contains 1000 coins. But one bag is full of forgeries, and she just can’t recall which one. She does know that genuine coins weigh 1 gram, but forgeries weigh 1.1 grams. To hide the fact that she can’t recall which bag contains forgeries, she needs your help. How can she identify the bag with the forgeries with just one weighing?
It is known that there is only one bag with forgeries. To identify that bag, Ishita can follow a simple procedure. She should take out 1 coin from the 1st bag, 2 coins from the 2nd bag, 3 coins from the 3rd bag and similarly 10 coins from the 10th bag.
Now she should simply weigh all these picked coins together.
If there were no forgeries, then the total weight should be (1+2+3+ . . . +10) = 55 grams.
Now, if the total weight comes out to be 55.3 then she can conclude that the 3rd bag contain forgeries. So, if the total weight is (55.n), then it is clear that the nth bag contain forgeries.
Attention reader! Don’t stop learning now. Get hold of all the important DSA concepts with the DSA Self Paced Course at a student-friendly price and become industry ready.