Question d’entretien chez Microsoft

Dynamic programming problem, or maybe it was greedy