Domanda di colloquio di Amazon

dynamic programming question from leetcode