Pregunta de entrevista de Meta

Leetcode medium should be enough to pass