Not able to approch the D.P

Hii…
I am doing this question from codeforces…
https://codeforces.com/contest/1455/problem/D
Although i have solved this using some greedy solution…
But in the editorial they are talking about some D.P. approch which i can’t understand.
Could you please provide some idea… How to approch this.
Thanks…

Hey @ashishnnnnn
I am myself not able to understand the DP code, I will update u if any video tutorial comes for it.

I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.

On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.