DP Tutorials
Basic Dynamic Programming
tip
Note: For visualising recursion tree of common problems like finding Fibonacci number, coin change problem, etc. you may use Recursion Tree Visualisation. Observe that DP can be applied only when there are overlapping subproblems.
2-D Dynamic Programming
- Read hackerearth article on 2-D Dynamic Programming
- Watch Video on "Coin change" (double counting) problem by Errichto
- Watch Video on "Line of wines" problem by Errichto
State Space Reduction
tip
You must take care of time limit and especially memory limit while using DP. Often problems are framed in such a way that it wants you to use your memory smartly.
Session slides
Additional Resources
You can also learn from Digit DP, a technique used to solve problems from this article
You can also go through this hackerrank article for many standard DP problems.
A great lecture series of MIT for some standard problems of dynamic programming :
Lecture 1 - Fibonacci and shortest paths
Lecture 2 - Text Justification, Blackjack