Pregunta de entrevista de IXL Learning

Leetcode question, not too hard