Pregunta de entrevista de Skyera

Was asked to optimizing a solution on a linked list solution