Pregunta de entrevista de Amazon

dynamic programming question from leetcode