Pregunta de entrevista de Sprout Social

The question was a Leetcode - Easy/Medium