Memoization tables and optimal substructure — watch subproblems fill in real time.
31 visualizations
Computes Fibonacci with top-down memoization, caching each subproblem so it's solved only once.
Maximizes value under a weight limit where each item is taken whole or not at all, via a DP table.
Finds the longest subsequence common to two strings by filling a 2-D DP table, then tracing it back.
Computes the minimum number of insertions, deletions, and substitutions to transform one string into another.
Finds the fewest coins that sum to a target amount, allowing each denomination to be reused any number of times.
Finds the contiguous subarray with the largest sum in a single linear pass using Kadane's algorithm.
Finds the longest strictly increasing subsequence via an O(n²) DP, tracking predecessors to rebuild the chain.
Finds the parenthesization requiring the fewest scalar multiplications.
Maximizes sale revenue by choosing the best sequence of rod cuts.
Determines whether some subset reaches an exact nonnegative target.
Checks whether a string can be segmented entirely into dictionary words.
Minimizes worst-case drops needed to locate a critical floor.
Finds the longest subsequence that reads identically in both directions.
Computes the minimum cuts that partition a string into palindromes.
Builds Catalan numbers from all left/right structural splits.
Finds an exact minimum Hamiltonian cycle with subset dynamic programming.
Counts bounded integers whose decimal digits satisfy a target sum.
Assigns each worker a unique job at minimum total cost.
Selects a maximum-weight compatible subset of intervals.
Chooses roots that minimize frequency-weighted search cost.
Matches an entire string against '.' and '*' using a Boolean table.
Tracks both maximum and minimum ending products to handle sign changes.
Maintains candidate lines to optimize affine DP transitions.
Uses monotone optimal split points to reduce interval DP from cubic to quadratic.
Computes each DP layer with recursively bounded monotone decisions.
Applies the subset zeta transform over all bitmasks.
Sweeps a narrow grid while encoding the frontier as a bitmask profile.
Combines take and skip states in postorder to optimize an independent set.
Transfers subtree contributions so every vertex receives its rooted answer.
Traces Bellman Q-table updates in a deterministic grid.
Applies synchronous Bellman optimality backups.