JPMorganChase Interview Question

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