Question d’entretien chez Amazon

dynamic programming question from leetcode