Question d’entretien chez F5

Manager gave me a algorithm question to solve-

Réponse à la question d'entretien

Utilisateur anonyme

7 août 2019

I solved it in iterative but in starting mentioned can be solved with recursion and got stuck for 15 mins and that was my mistake.