Question d’entretien chez Amazon

Hard dynamic programming question, see leetcode most frequently asked