DP Problems
DP Problems
of simpler subproblems, solving each of those subproblems just once, and storing their solutions using a
memory-based data structure (array, map,etc). Each of the subproblem solutions is indexed in some
way, typically based on the values of its input parameters, so as to facilitate its lookup. So the next time
the same subproblem occurs, instead of recomputing its solution, one simply looks up the previously
computed solution, thereby saving computation time. This technique of storing solutions to
subproblems instead of recomputing them is called memoization.
Here’s brilliant explanation on concept of Dynamic Programming on Quora Jonathan Paulson’s answer
to How should I explain dynamic programming to a 4-year-old?
Please find below top 50 common data structure problems that can be solved using Dynamic
programming -
Find size of largest square sub-matrix of 1’s present in given binary matrix
Find the minimum cost to reach last cell of the matrix from its first cell
Find longest sequence formed by adjacent numbers in the matrix
Count number of paths in a matrix with given cost to reach destination cell
Coin Change Problem (Total number of ways to get the denomination of coins)
3-Partition Problem
15. Find the minimum cost to reach last cell of the matrix
from its first cell