JPMorganChase interview question

A Dynamic Programming based problem which I have to code on Codepair platform