Pregunta de entrevista de Valeo

Train based type problem