Pergunta de entrevista da empresa Google

Dynamic programming problem for first interviewer. Linked list question with the second interviewer.