my code:
editorial:
both are almost the same but mine is giving error.
Please point out the mistake.
my code:
editorial:
both are almost the same but mine is giving error.
Please point out the mistake.
@Rhinorox
Add these two conditions in the staring of loop
if (k < 0 || k > n) {cout<<1<<endl; continue; }
if (n-k < k) k = n-k;
Also inside loop, ans should be
ans=ans*(n-i+1);
ans/=(i);
How your code got AC? Letβs suppose extra case is take care of. So, your code get AC because of starting the denominator from β1β instead of βkβ. Am i correct?
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.