Pergunta de entrevista da empresa Adobe

How would you code a factorial function using no built in functions in R?