Dynamic programming

c
c-plus-plus
data-structure
dynamic-programming
editorial

#1

Question

Solution

http://pastebin.com/1R543whN

Thing is that I can’t formulate the solution from editorial or given link above can anyone explain
in detail with recursive solution also.