Goldman Sachs interview question

Dynamic programming in coding, explaining how and what, roughly, will solve the problem