The code is giving runtime error on some cases, please review the code for once.
RUNTIME Error - Marbles
Hi @ria_jhaX5P, I have corrected your code here
I have simplified your printNCR function
runtime error was caused maybe due to integer overflow .
In case u are wondering why ans is NCR(n-1,k-1)
Explanation for that would be :-
Fill n spaces , with k colors. First select k spaces with k-different color. Now we are left with n-k spaces ,which can be filled with any of the k colors. Now to fill m-spaces by r-color with each r is infinte amount,we do this…
Using a method that’s often called “stars and bars”: We draw n stars in a row to represent the cakes, and k−1 bars to divide them up. All of the stars to the left of the first bar are cakes of the first type; stars between the first two bars are of the second type;
|||| Here’s an example with n=6 and k=5. We’re getting 2 of the first type, 3 of the second type, 0 of the third type, 1 of the fourth type, and 0 of the fifth type. In order to solve the problem, we just need to reorder the stars and bars by choosing the k−1 spots for the bars out of the n+k−1 total spots, so our answer is:
(n-1)C(k-1) = C(n-1,k-1)
In case of any doubt feel free to ask 
mark your doubt as resolved if you got the answer