Help with interesting dp problem
Can anybody help me with this dp problem i've recently got stuck at?
Problem Link