This code is faling 3 testcases
Can you please check why?
Hi can you please provide me some comments in your code for me to easily debug
// I am just raising 364/365 to the power of nC2 where n keeps on increasing
your logic is little flawed , let me explain the correct
Let the probability that two people in a room with n have same birthday be P(same). P(Same) can be easily evaluated in terms of P(different) where P(different) is the probability that all of them have different birthday.
P(same) = 1 – P(different)
P(different) can be written as 1 x (364/365) x (363/365) x (362/365) x …. x (1 – (n-1)/365)
but what you are doing is calculation P(different) as 1 x (364/365) x (364/365) x (364/365) x …. x (364/365)
here , you can refer to the code of using above logic
I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.
On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.