Birthday paradox

again one test case is not pass.plzz clear this.

hi @np354813, you are missing one corner case of p=1, as you will notice your algo will not work for p=1 (check by printing value of x for input 1), so just accomodate that case , so when p=1 , print 366,
here i have corrected your code : https://ide.codingblocks.com/s/231594
In case of any doubt feel free to ask :slight_smile:
If you got the answer then mark your doubt as resolved

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.