2 test cases not passing MARBLES problem

Hi @utsavjn48

Your code is failing on very large inputs where the answer exceeds the size of unsigned long long. Instead you can use a loop traversing from i = n-1 down to n-k+1 and in a single traversal you multiply ans with i and divide ans by (n-i). Hence you will finally get (n-1)C(k-1).

Hope it Helps.

@utsavjn48
Please mark your doubt as solved.

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.