Pregunta de entrevista de Amazon

leetcode hard question using dynamic programming