n is large while r is small, you are better off compute nCr by n(n-1)…(n-r+1)/(1*2*…*r)
You may need to find multiplicate inverse of 1, 2, … r mod 10^9+7
solved nCr mod 10^9 + 7 for n<=10^9 and r <=1000 [closed]
n is large while r is small, you are better off compute nCr by n(n-1)…(n-r+1)/(1*2*…*r)
You may need to find multiplicate inverse of 1, 2, … r mod 10^9+7
solved nCr mod 10^9 + 7 for n<=10^9 and r <=1000 [closed]