Factorial interview question

How would you solve the problem I have?