Pregunta de entrevista de Amazon

Some DP problem hard from leetcode