Puzzle | Find the cat

A cat is hiding in one of the five boxes. The boxes are numbered one to five and are all sitting in a row, lined up in order. Each night, the sneaky little cat hides in an adjacent box, exactly one box away from the box it’s in during the day. Each morning, you can open exactly one box to see if the cat is in there. Can you say with certainty that you will find the cat ? How can you go about this hide and seek game to ensure you find the cat?

Solution:
Yes, it is possible to ensure a victory in this hide and seek game. Since the cat always jumps into an adjacent box, you’ll know after opening the first box when the cat is in an odd or even numbered box.

First, consider the case when the cat started in an even numbered box, i.e., 2 or 4.
On day 1, check box numbered 2. If you find the cat, you win. Otherwise, the cat must have been in box numbered 4 (considering only for even number case). So, next day the cat will move to either box numbered 3 or 5.
On day 2, check box numbered 3. If you find the cat, you win. Otherwise, the cat must have moved to box numbered 5 and which means the cat can now only move to box numbered 4 on the next day. So, now we check box numbered 4 and we will certainly find the cat!

Now, let’s consider the case when the cat started in an odd numbered box, i.e., 1, 3 or 5.
Following the previous strategy, till day 4 cat would be in either box numbered 2 or 4 because:
On day 1, cat is in an odd numbered box 1 or 3 or 5.
On day 2, cat will be in an even numbered box 2 or 4.
On day 3, cat will again move to an odd numbered box.
And therefore on day 4, cat will be either in box numbered 2 or 4 again.
This situation is same as the previous case. We can follow the same strategy of checking boxes “2, 3 and then 4” and we will find the cat.

Hence, final solution is 2, 3, 4, 2, 3, 4
Other solution could be 2, 3, 4, 4, 3, 2

This puzzle can be extended for n boxes. And for more insights, check this video:
https://curiosity.com/videos/can-you-find-the-hiding-cat-hard-riddle-mindyourdecisions/

This article is contributed by Lakshya Sethi. If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to contribute@geeksforgeeks.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.

Please write comments if you find anything incorrect, or you want to share more information about the topic discussed above.



My Personal Notes arrow_drop_up


Article Tags :
Practice Tags :


1


Please write to us at contribute@geeksforgeeks.org to report any issue with the above content.