Pregunta de entrevista de Instructure

How would you code this recursively versus iteratively?