What is dynamic programming?
Lesson 1 of 15 in Coddy's Dynamic Programming 101 course.
Dynamic programming (DP) is an algorithmic technique used to solve optimization problems by breaking them down into simpler subproblems and reusing the solutions to those subproblems to solve the original problem.
DP is often used for problems where the solution can be expressed recursively in terms of smaller subproblems. The technique is called "dynamic" because solutions to subproblems can be stored and reused to solve larger problems, making the process more efficient than simply solving the larger problem from scratch.
DP can be used for a variety of problems, such as shortest path, longest common subsequence, and maximum subarray. It is especially useful when the problem has overlapping subproblems and optimal substructure, which means that the optimal solution to the problem can be constructed from the optimal solutions to its subproblems.
Try it yourself
This lesson doesn't include a code challenge.
All lessons in Dynamic Programming 101
3Dynamic programming algorithms
Longest common subsequenceKnapsack problemCoin change problemEdit distance