Last active
May 27, 2020 18:52
-
-
Save chesterbr/756abf7388a29530a365 to your computer and use it in GitHub Desktop.
Cheryl's Birthday (aka Birthday problem)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
https://en.wikipedia.org/wiki/Cheryl%27s_Birthday | |
A knows the month | |
B knows the day | |
The candidates are: | |
may 15 16 19 | |
june 17 18 | |
july 14 16 | |
august 14 15 17 | |
A asserts B doesn't know the date. He can only say that with certainty if the month | |
(that A knows) doesn't contain unique days. That rules out may (which contains 19) | |
and june (which contains 18). | |
B, realizing the fact above, reduces the list to: | |
july 14 16 | |
august 14 15 17 | |
and says he knows the date. That implies the the day is NOT 14 (after all, he could not | |
know the month in that case) | |
With that in mind, A can reduce the list to: | |
july 16 | |
august 15 17 | |
And now A says he knows the day. But that means the month can't be august (because it | |
has two days), hence we rule out august, and the date must be July 16! | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment