MARBLE problem. Approach: finding the positive integral solutions in x1+x2+x3+.....xk=n which is equivalent to n-1 C k-1

Can anyone point out my mistake. I am finding n-1 C k-1 . But it’s still giving 2 test cases wrong. I am finding this in O(n*k) . ( Its giving wrong answer and not time limit exceeded )

code :
https://pastebin.com/nH2h6y8X

Your answer is overflowing since numbers are pretty big.

So what is the way out ? I am using datatype unsigned long long to store the answer… And it has not been told to return answer as modulus of the result. Is there any other approach that i am missing. ? A small hint will be useful. Thank you

Sorry for a late reply.
In this question, we need to use string multiplication to store such large nCr. You can leave that since you have done the question well otherwise or you may implement it if you want.

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.