Facto sum i dont know why i am getting 3 wrong test cases
Actually the recursive method of finding factorial is very inefficient as its complexity is O(2^n)
Hence recursive method of computing factorial will not work for numbers as big as 1000
Try to find factorial by DP. That would make the program much more efficient…
You can even compute and store factorial of 1000 numbers and store it in array of size 1000
And then just use element at index to compute answer
Also use the formula
(a+b)%n = ( (a%n) + (b%n) ) % n
This would also make the program more efficient…
why this is more efficient
and how to use dynamic programming in this
please show me by editting my code
please answer fast …