Top 10 Algorithms for Coding Interview
There are 50 people in a room, what's the probability that two people have the same birthday? (Ignoring the fact of leap year, i.e., 365 day every year)
Very often calculating probability of something can be converted to calculate the opposite. In this example, we can calculate the probability that all people have unique birthdays. That is: 365/365 * 364/365 * 363/365 * ... * 365-n/365 * ... * 365-49/365. And the probability that at least two people have the same birthday would be 1 - this value.
Read full article from Top 10 Algorithms for Coding Interview