Pregunta de entrevista de Perchwell

Solve a medium programming question live.