Pregunta de entrevista de Squarepoint Capital

Dice questions, Dynamic programming coding test