Question d’entretien chez Citadel Securities

asked to solve a problem about dynamic programming