Question d’entretien chez Datadog

Implement a recursive algorithm to satisfy the required outcome.