I am solving this problem got the greedy solution but interested to solve this via dp as well can someone explain the dp solution in more better way than editorial ( i am unsatisfied with editorial).
Problem Link -> https://codeforces.net/problemset/problem/321/B