Question d’entretien chez Amazon

Question based on stacks and then dynamic programming