Pregunta de entrevista de Microsoft

A dynamic programming question was asked