Dynamic Programming

Here is a quick introduction to the Dynamic Programming paradigm!

What is Dynamic Programming?

Dynamic Programming algorithms solve problems by combining results of subproblems— just like Divide and Conquer algorithms.

Those who cannot remember the past are condemned to repeat it” – Dynamic Programming

Characteristics

  1. Overlapping Subproblems: the subproblems of a given problem are not independent; in other words, two subproblems don’t share a subsubproblem.

  2. Optimal Substructure Property: the overall optimal solution of the problem can be constructed from the optimal solutions of its subproblems.

Dynamic Programming Patterns

Memoization (Top Down)

The memoized version of a problem is similar to the regular recursive version, except that it looks for the answer of a subproblem in a lookup table before computing its solution.

Level up your interview prep. Join Educative to access 80+ hands-on prep courses.