Walmart Interview Question

Repeated Factorial calculation optimisation