Pregunta de entrevista de Google

Coding question about linked lists and dynamic programming