Pergunta de entrevista da empresa Duco

It was a 2-dimensional dynamic programming question.