Question d’entretien chez Amazon

Leetcode medium one-dimensional dynamic programming question.