Explain the concept of dynamic programming.
Dynamic programming (DP) is a method used in algorithm design to solve complex problems by breaking them down into simpler overlapping subproblems and solving each subproblem just once, storing its solution for reuse. This approach is particularly useful for optimization problems where the solution involves making a sequence of interdependent decisions.