Question: On a certain island there are people with assorted eye colors. There are 100 people with blue eyes and 100 people with brown eyes. Since there are no mirrors on this island, no person knows the color of their own eyes. The people on the island are not allowed to talk or communicate with each other in any way. They are also NOT aware of the number of blue or brown eyed people on the island. For all they know, they could have red eyes too. But they are allowed to observe other people and keep count of the number of people with a certain eye color. There is a rule that the people on the island have to follow – any person who is sure of their eye color has to leave the island immediately.

One day, an outsider comes to the island and announces to the people that he sees someone with blue eyes. What do you think happens?

Answer: If you read the Cheating Husbands Puzzle, then this puzzle should be cake walk. The very same logic applies here as well. Let’s solve the trivial case. If there was only one blue-eyed person on the island, then that person would look around and see that there is no other blue-eyed person. So he realizes that he is the only person with blue eyes on the island and leaves the day of the announcement.

If there are 2 blue-eyed people, then they look at each other. Each one expects the other to leave on the day of the announcement. However, when they realize that neither of them left of the island, they would be able to deduce that both of them have blue eyes. They both leave the island on the second day.

Through induction, this logic can be applied to the 100 blue-eyed people on the island. So on the 100th day, all the 100 blue-eyed people leave the island.

This puzzle has been adapted from http://www.xkcd.com/blue_eyes.html

If you're looking for some serious preparation for your interviews, I'd recommend this book written by a lead Google interviewer. It has 189 programming questions and solutions:

## 9 Responses

1. How do you say the people know the exact number of blue/brown eyed people (i.e., 100) and also what if a brown eyed,sees a blue eyed,expects him to move,while that blue eyed waits for someone else? . . Wont the brown eyed mistake’s ,he has blue eye and leave??
The problem isn’t clear . .

2. Amit says:

xyz,

the problem states, “The people on the island are not allowed to talk or communicate with each other in any way”.

how come they could come up with the waiting for 100 days solution. IMO, the brown eyed people would also think they have blue eyes when they see that no one is leaving.

3. Ashish Jain says:

All the blue eye people will leave on 100th followed by Brown People. Here it goes:

Lets assume there are only 2 Blue eyed people say A, B.

Day 1: A & B see each other and assumes that the other is the only blue eyed – nobody leaves
Day 2: A sees B and realize that there is one more blue eyed thats why B has not left. A & B leaves on Day2

Now lets increase the Blued eyed people to 3:

Day 1: A sees B & C and assumes that there are only 2 blue eyed people. – Nobody leaves

Day 2: A sees B & C again and as per the logic discusses above(when there are only 2 blue eyed people). as per A, B & C will leave on day 2 but they will not because A, B and C each saw 2 blue eyed people and nobody leaves.

Day 3: A, B, C realizes that they have blue eyes and all leave on day 3.

based on induction then 100 blue eyed people will leave on 100th day followed by brown people.

4. xyz says:

So the way this works is that to each blue eyed person, there are 99 blue eyed people
to each brown eyed person, there are 100 blue eyed people.
So the blue eyed people will wait for 99 days and on the 100th day, they will all leave. Every brown eyed person would wait for 100 days before taking any action. Since on the 100th day, all the blue eyed people left, they can stay behind knowing they don’t have blue eyes (this doesn’t mean they know what their own eye color is)

5. saptarshi says:

There is also a problem. How come first person who leaves the island, w’d know his eye color is blue ? he will see 99 other (He counted the numbers ) having blue eye is not leaving .

6. saptarshi says:

“an outsider comes to the island and announces to the people that he sees someone with blue eyes.” – why this should make any difference all the people on island already know there is at least 99 people with blue eyes.

7. Aswin says:

The 100 brown-eyed people do not know that all the remaining people have brown eyes. According to them, they are only sure that they do not have blue eyes but they could have eyes of another color (red for example). Only we know that there are 100 brown-eyed and 100 blue-eyed people but they don’t.

8. BernieR says:

Hi,
Thanks for article. Everytime like to read you.
BernieR

XHTML: These are some of the tags you can use: `<a href=""> <b> <blockquote> <code> <em> <i> <strike> <strong>`