Pregunta de entrevista de Google

Coding problem related to lists manipulation