# 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.

## Recommended Posts:

- Find minimum elements after considering all possible transformations
- Puzzle 1 | (How to Measure 45 minutes using two identical wires?)
- Puzzle 2 | (Find ages of daughters)
- Puzzle 3 | (Calculate total distance travelled by bee)
- Puzzle 4 | (Pay an employee using a 7 units gold rod?)
- Puzzle 13 | (100 Prisoners with Red/Black Hats)
- Puzzle 5 | (Finding the poisoned wine)
- Puzzle 6 | (Monty Hall problem)
- Puzzle 7 | (3 Bulbs and 3 Switches)
- Puzzle 8 | (Find the Jar with contaminated pills)
- Puzzle 9 | (Find the fastest 3 horses)
- Puzzle 10 | (A Man with Medical Condition and 2 Pills)
- Puzzle 11 | (1000 Coins and 10 Bags)
- Puzzle 12 | (Maximize probability of White Ball)
- Puzzle 14 | (Strategy for a 2 Player Coin Game)