IPL, Zonal Computing Olympiad 2014, 30 Nov 2013

I have gone through the previous discussions about the problem on Codechef but couldn’t really get the logic behind the dynamic programming solution. I would be grateful if you could explain the reason behind the solution along with the method for forming the equation of state. Code for the same is highly appreciated (in C++). Any advice on a general method to approach DP problems is highly appreciated.

My code : https://www.codechef.com/viewsolution/26761389

Hope you understand
Sudheera Y S

1 Like

Thanks for the code. I’ll go through it.

But can anyone suggest how can we develop these DP equations for such problems because the only thing I find on the internet is the Fibonacci example. It would be great if someone could post a link for a PDF which contains puzzles to be solved using pen and paper involving such DP equations.

The only way to be more good at Dynamic Programming is to try its problems more and more. For this, I found two good series of Dynamic programming

  1. Tushar Roy’s
  2. Abdul Bari’s

P.S: I am not related to any of these youtubers and neither advertising them. Just giving @utkarsh1729 sources where he can learn dynamic programming.

And keep solving problemsbased on dynamic programming on Codechef and any other site in which you do coding. Start from the easiest then go ahead, but practice as many problems you can.

Hope this was useful.

Thank you very much!!! The Codechef community is indeed very helpful.

1 Like

Some resources which were very helpful for me while learning DP