Genie with C Hats Puzzle (Interview Puzzle)

7 years ago Lalit Bhagtani 0

Genie with C Hats Puzzle :- There are N number of men and one genie on a deserted island, A genie gathers all the men and put the hat on C number of men’s head, such that one man has only one hat on his head. The hat has some magical powers, hat cannot be seen by the man who is wearing it, but all the other man can see it, whether they are wearing any hat or not. To remove the hat, men (only those who has a hat on his head) must dip themselves underwater at exactly midnight. How many days, it will take the men to remove all the hats?

Note :-

  1. At least one man has a hat on his head (C > 0).
  2. Men cannot tell each other that they have a hat.
  3. Men don’t know about the total number of hats, i.e they don’t know about C.

 

Genie with C Hats Puzzle

Now try to solve this on your own…

Solution of Genie with C Hats Puzzle :-

Let’s take an example of 3 men on a deserted island and let’s name them for easy understanding :-

 First man ->  M1

 Second man -> M2

 Third man -> M3

Since there are 3 men on a deserted island, So genie can put maximum of 3 hats ( Max value of C is 3)




Scenario 1 (C = 1) :- In this scenario, a genie will put only one hat on anyone of the three man. Let’s say, he put a hat on M2. Now, M2 will see no other man with the hat while M1, M3 will see one other man (M2) with the hat. So he will understand that he is the one with the hat on his head and will go underwater on the first night. Hence answer is 1.

Scenario 2 (C = 2) :- In this scenario, a genie will put two hats on any two of the three man. Let’s say, he put a hat on M1, M2. Now, M1, M2 will see one other man with the hat while M3 will see two other men with the hat. Now if there was only 1 hat, this scenario would have been solved on the first day, but in this case, no one will go to water on first night. On the second day, a man who sees one hat will understand that there must be one hat on his head, So both of them will go underwater on the second night. Hence answer is 2.




Scenario 3 (C = 3) :- In this scenario, a genie will put the hat on all three man M1, M2, and M3. Here, M1, M2, M3 will see two other men with the hat. Now if there were 1 or 2 hats, this scenario would have been solved on the first or second day, thus on third day man who can see two hats will understand that they have hats on their head and they will all go underwater on the third night. Hence answer is 3.

So the answer of Genie with C Hats Puzzle is C.

That’s all for Genie with C Hats Puzzle, If you liked it, please share your thoughts in a comments section and share it with others too. For more interesting puzzles visit Interview Puzzles.