[Leetcode] Delete and Earn - Clarifying solution

I tried out the Delete and Earn problem on Leetcode

except I wasn’t able to code out an initial approach completely.

I don’t think I actually understand the dynamic programming approach the solution describes:

Can anyone please explain it for me?

Check out this explanation, the idea behind this problem is very similar to the house robbing problem