Python3 soln using mathematical approach factorial array is stored dynamically
fact = [ 1 ] NEW_LINE def preComputeFact ( n ) : NEW_LINE INDENT for i in range ( 1 , n + 1 ) : NEW_LINE INDENT fact . append ( ( fact [ i - 1 ] * i ) ) NEW_LINE DEDENT DEDENT