Question d’entretien chez Amnet Digital

Q. Write a Python function to calculate the factorial of a given non-negative integer. Provide both iterative and recursive solutions, and analyze their time complexity

Réponse à la question d'entretien

Utilisateur anonyme

13 mars 2024

def factorial_iterative(n): result = 1 for i in range(1, n + 1): result *= i return result

1