Pregunta de entrevista de LinkedIn

Dynamic programming question, don't remember the details