Dynamic Programming

I have fundamentally grasped the concept of DP but i am struggling to apply this to this context