Dynamic Programming is style of coding where you store the results of your algorithm in a data structure while it runs.
Understanding Dynamic Programming can help you solve complex programming problems faster.
These methods can help you ace programming interview questions about data structures and algorithms. And they can improve your day-to-day coding as well.
We released a 5-hour course on Dynamic Programming on the freeCodeCamp.org YouTube channel.
Alvin Zablan developed this course. Alvin is an experienced programming instructor at Coderbyte, a popular website for technical interview prep and coding challenges.
In this course you will learn to use Dynamic Programming strategies to solve programming challenges such as:
- Calculating the 40th number of the Fibonacci sequence.
- Counting the number of different ways to move through a 6x9 grid.
- Given a set of coins, how can you make 27 cents in the least number of coins.
This course uses images and animations to help you visualize problems and important concepts. After understanding problems conceptually, you will learn how to solve them in JavaScript using Dynamic Programming.
Even though this course uses JavaScript, you will learn concepts and knowledge that you can apply to other programming languages, including Python.
Dynamic Programming can really speed up your work. But common sense can speed things up even further. (Traveling Salesman problem webcomic by XKCD)
Dynamic Programming Methods This Course Covers
Part one of this course focuses on Memoization methods. This is where you use recursion and store the intermediate results of your algorithm. You can then access those results on later trips through your your loops.
Here are the Memoization strategies this course covers:
- fib memoization
- gridTraveler memoization
- memoization recipe
- canSum memoization
- howSum memoization
- bestSum memoization
- canConstruct memoization
- countConstruct memoization
- allConstruct memoization
And part two focuses on Tabulation strategies. These involve building up a table of data iteratively.
Here are the Tabulation strategies this course covers:
- fib tabulation
- gridTraveler tabulation
- tabulation recipe
- canSum tabulation
- howSum tabulation
- bestSum tabulation
- canConstruct tabulation
- countConstruct tabulation
- allConstruct tabulation
You can watch the full course on the freeCodeCamp.org YouTube channel (5-hour watch).