Question d’entretien chez Instructure

How would you code this recursively versus iteratively?