Dynamic programming (DP) is an optimization technique used to solve complex problems by breaking them into smaller subproblems.
An example of a dynamic programming algorithm is the Fibonacci problem we solved in Chapter 9, Recursion. We broke the Fibonacci problem into smaller problems.
There are three important steps we need to follow when solving problems with DP:
- Define the subproblems.
- Implement the recurrence that solves the subproblems (in ...