#dynamic-programming
5 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.
Monotonic Queue: Sliding Window Maximum in O(n)
Learn the monotonic queue: the deque discipline that solves Sliding Window Maximum in O(n) and collapses windowed DP like Jump Game VI from O(nk) to O(n).
The Knapsack DP Patterns
Master 0/1 and unbounded knapsack DP: the take/skip recurrence, the 1D space trick, and why subset sum, coin change, and target sum are the same problem.
Dynamic Programming on Grids
Dynamic programming on grids turns unique paths, min path sum, LCS, and edit distance into one table-filling exercise — draw the arrows, fill in order.
Dynamic Programming: The Real Guide
Dynamic programming is a four-step framework for turning exponential recursion into polynomial solutions — master it once and every DP problem opens up.