Facto sum problem

here’s the link to the code.
i’m only getting 50 points out of 100.
help!!

hello! your code is fine except one thing actually you misunderstand the modulo property .Suppose your sum variable becomes larger , so u are finding the factorial first which in this case u can’t . So u need to take modulo with 107 in every iteration of while loop .Okay , go through this you will be able to understand https://ide.codingblocks.com/#/s/14122

1 Like

Thank you so much for the help!!
is this the optimized solution to the code or there is any other possible way to optimize the solution?

As the array input is always in sorted order, u need not to calculate every factorial from 1.
for e.g if input is 3 5 7
you can calculate 3! first & 5!=543! 7!=765! by using your previous calculated data.