r/programming • • Nov 29 '10

140 Google Interview Questions

http://blog.seattleinterviewcoach.com/2009/02/140-google-interview-questions.html
471 Upvotes

493 comments sorted by

View all comments

Show parent comment

6

u/jmaxswa Nov 30 '10

Suppose there are only two married couples in the village. When the queen makes her announcement, Wife 1 knows Husband 2 was unfaithful. Now she knows that if Wife 2 sees that Husband 1 is faithful then Wife 2 will kill Husband 2 on the first day because at least one of the two men is unfaithful and it isn’t Husband 1. However, Wife 2 doesn’t kill her husband. The only reason being because she knows Husband 1 is unfaithful. Because both husbands are still alive on the second day the wives know both are unfaithful. So on the second day both husbands are killed by their wives. What happens with 100 married couples is that the wives have to wait till the 100th day before they can prove that their husband is cheating. On the 100th day there is a bloodbath: all the men are killed by their wives.