Question d’entretien chez TikTok

Solve this coding challenge please?