Duco interview question

It was a 2-dimensional dynamic programming question.