problelm link any one can help me with the dp solution of this problem… thanks for the help…
See official Editorial with explanation and c++ code. This might help you to get understand better.
Also you can check others submissions too by following simple two steps.
click on this link
Apply this filter ( available on below left of the page )
Click on any submission to see the code