Pregunta de entrevista de Sahl

Hard/medium common problem from leetcode