Question d’entretien chez Ballistic Learning

Write the Algorithm of the code question and how can it be more optimized