Domanda di colloquio di Publicis Sapient

Leetcode type question which I'd say was easy.