Bloomberg interview question

Dynamic programming question that was difficult