VOOZH about

URL: https://www.geeksforgeeks.org/aptitude/puzzle-9-students-and-red-black-hats/

โ‡ฑ Puzzle | 9 Students and Red Black Hats - GeeksforGeeks


  • Courses
  • Tutorials
  • Interview Prep

Puzzle | 9 Students and Red Black Hats

Last Updated : 27 Apr, 2026

There are 9 students sitting in a classroom. A professor enters the room carrying a bag and addresses the students:

  • Inside this bag, there are 9 hats.
  • Each hat is either red or black in color.
  • There is at least one red hat.
  • Number of black hats is greater than the number of red hats.
๐Ÿ‘ hats_1

He then places one hat on each studentโ€™s head and leaves the room. Each student can see everyone elseโ€™s hat, but cannot see their own.
They are not allowed to communicate in any way.

After 20 minutes, he returns, but no student is able to answer.
He gives them 10 more minutes, but still, no one answers.
Finally, he gives them an additional 5 minutes.

When he returns after the final 5 minutes, all the students are able to correctly determine the color of their own hat.

Check if you were right - full answer with solution below.

Solution:

The solution can be derived using the logical process of assumptions and conclusions divided into three parts.

After the first 20 minutes:

Let's assume that there is one red hat and 8 black hats.

Now the student with the red hat would have been able to see the 8 other black hats.

But since no answer was given after 20 minutes, then this assumption is wrong.

Hence the combination of 1 red hat and 8 black hats are wrong.

๐Ÿ‘ hats_2

After the next 10 minutes:

Let's assume that there are 2 red hats and 7 black hats.

Now both students with a red hat can see the other 7 black hats and 1 red hat.

Therefore they know that since the first assumption was wrong, they must be wearing a red hat.

But since no answer was provided, the assumption of 2 red hats and 7 black hats is also wrong.

๐Ÿ‘ hats_3

The final interval of 5 minutes:

Let's assume that there are 3 red hats and 6 black hats. Every student with a red hat on them is able to see the other 6 black hats and two red hats.

Therefore he knows that since the first two assumptions were wrong, he must be wearing a red hat.

Since this is the last chance, and the answer provided by them was correct, this assumption is logically valid and true.

So there are 3 red hats and 6 black hats.

๐Ÿ‘ hats_4

Though we got the correct combination, how come everybody came up with the correct answer including the holder of black hats, since only the 3 red hat ones knew the answer.

A layman's approach would tell us that since it was the last chance for them to answer, then the professor might have been expecting an answer on the third interval or 3rd chance of assumptions.

Comment