Question d’entretien chez Globant

I was asked a programming Leetcode-type question in Javascript