Can anyone explain this weird behavior ??
(correct one has accepted submission)
why this line is wrong
((fact[n] % mod) * ((mul[k] % mod) * (mul[n - k] % mod)) % mod) % mod;
and this is correct
(fact[n] % mod * (mul[k] % mod * mul[n - k] % mod) % mod) % mod;
while in this problem https://www.hackerrank.com/challenges/summing-the-n-series/problem
this is correct
((n % mod) * (n % mod)) % mod
and this is wrong
(n % mod * n % mod) % mod
I only applied the bracket to make it cleaner.
is the problem on their side ??