ContentWise interview question

Implement a recursive function to compute the factorial and optimize it