When I was the 2nd year student in my computer science under-grad course, solving logical and computational problem was my favorite hobby. Some of those were directly related to programming and some were just brainstorming. When not engaged with study, I passed my time either using pen and pages to draw diagrams or just seen in the sky whether I can find any solutions there!
12 Marbles Problem
Among all of the problems that I found and solved, the most interesting problem to me was "12 marbles problem". One of my senior course mate gave it to me. When I first hear it, it didn't seemed much complex to me. He smiled to me to see it, and told, "well lets solve it first!". Ah, very soon I got understood why he smiled at me! The problem started to take my hours after hours, days after days! I really forgot my daily life, by this time, couldn't study well, couldn't eat, couldn't sleep...12 marbles were moving and playing around my world! After 3-4 days, I got really embarrassed, and thought there might be no solution for it, so I shouldn't try to solve it more. Or at least I should drop it for few days, coz I have lots of other stuffs to do! Sometimes, even a simple problem may turn to too complex, by continuously thinking of it. Leaving it for few time will create some new views to solve the problem. Can't remember how many days I left the problem, but after few days again, I started to think about it, with new energy! Ah, it was a cool feelings for me when I got the solution! And couldn't believe first, I have solved it! Also got lost soon, as the solution itself is not that much simple.
Finally I grabbed the total solution, by more careful and patient thought! And felt that, this is the only solution for it that I just found! It was a matter of great joy for me, as so far I learned only a few number of person have solved it! But the interesting thing was, when I have heard their solution, I found those are separate to each others and even separate from my solution! Well, lets see the problem and see whether you can find your own solution !
You have 12 marbles. All the marbles have the same look and same weight, but there is a defective one, which weight is a bit more or less than others. Using a balance just three times, you have to find the defective marble!
400 Marbles Problem !
Once I solved it, I was given another problem :P By this time I have 400 marbles and I can use a weight machine only one time! Huh! Kidding? 400 marbles and can take weight only once? I didn't want to spent hundreds of "MAD" days for just to solve one problem, since 12 marbles took my few days to solve! But once I surrendered, when I heard the solution, I really wanted to kick at my ass! Ah, how easy the solution is! Basically although it was about 400 marbles, but it is much easier than before. So found a moral on problem solution: "Sometimes solving complex problems made our thoughts complex. You can find a solution easily, just by understanding the problem clearly, and then find your best way to solve it!"
Any way, lets see the interesting problem, and check which one you find easier!
You have 20 boxes, each of the boxes has 20 marbles, each of the marbles is weighted 20 gram. There is only one box which has 20 marbles, but each of which marbles has 1 gram less or more than 20 gram. You have a weight machine, which can be used only once, to find which box contains less or more valued box.