#dynamic-programming
4 articles
Dynamic Programming for Beginners
Dynamic programming demystified — learn how overlapping subproblems and optimal substructure turn exponential brute-force recursion into clean O(n) solutions, starting from Fibonacci.
The Knapsack DP Patterns
0/1 knapsack, unbounded knapsack, and their disguises — subset sum, coin change, partition equal subset, target sum. Master the state definition, take/skip recurrence, and the 1D space optimization that makes these problems click permanently.
Dynamic Programming on Grids
Grid DP is the pattern behind unique paths, minimum cost routes, edit distance, and longest common subsequence. Once you see the dependency arrows, every 2D DP problem becomes the same fill-order exercise.
Dynamic Programming: The Real Guide
Dynamic programming isn't about memorizing patterns — it's a four-step framework for turning exponential recursion into linear solutions. Master the mental model once and every DP problem opens up.