Codevita Max Sum Problem

Can someone kindly explain how to solve the problem “Max Sum” in Codevita using Dynamic Programming? Yes DP soln got accepted for private test cases too.

Here’s a link to the problem: Max Sum Codevita Solution 2020 - TechBomb