Dynamic Programming is probably the most feared but misunderstood techniques when solving any algorithmic problem.
The core idea of dynamic programming is optimization on top of recursion. To put it simply, dynamic programming says that if you are solving a problem recursively, store the intermediate results of recursive call so that you can reuse it later.
What makes dynamic programming difficult ?
As we discussed before, dynamic programming is just an optimization on top of the recursion.
The biggest difficulty that people face when applying dynamic programming is that they are not able to think recursively. Before we can start optimizing recursive solution, we need to first form the recursive solution!
Therefore, before you get started with dynamic programming you should focus on improving your recursion skills. This includes, understanding how to break down a problem into multiple steps and sub-problems.
In the coming sections, we will go over these things one by one.