Pregunta de entrevista de Meta

It was a leetcode question