Algorithm visualizer
Pick an algorithm, enter your own numbers or use a preset, then step through the run. The pseudocode and the explanation follow each step.
Build dp[a], the fewest coins that make each amount a, from smaller amounts. Each amount tries every coin it can use.
Use coins 2 and 5 for amount 11. Is it possible? Explain from the table without running it.
Step 1 of 21
cell being filled cells it depends on
dp[0] = 0: zero coins make amount 0. Other amounts start at ∞.