#1 India's Top IT Training Institute

×

About Uncodemy

Know more about who we are and what we stand for.

About Us

About Us

Discover our mission to equip individuals with essential IT skills and industry expertise.

Read More →
UnCodeMy Gallery

UnCodeMy Gallery

Explore highlights from our IT training sessions and success stories.

Read More →
×

Free Resources

Learn, practice and plan your career — bilkul free.

Tutorials

Tutorials

Step-by-step written tutorials to learn any technology at your own pace.

Read More →
Free Counselling

Free Counselling

Book a free video counselling session and pick the right course for you.

Read More →
Online Compiler

Online Compiler

Write, run and test your code online — no setup required.

Read More →
⚡ FREE · 5 CLASSIC PROBLEMS

DP Table Visualizer: Watch Dynamic Programming Fill the Table

Pick a classic DP problem and step through the table one cell at a time.

  • 🧩 LCS and edit distance
  • 🎒 0/1 knapsack
  • 🪙 Coin change

How to use the Dynamic Programming Table Visualizer

  1. 1. Pick a problemLCS, edit distance, knapsack, or coin change (ways or fewest coins).
  2. 2. Enter the inputsTwo strings, item weights and values, or coins and an amount.
  3. 3. Step throughEach cell shows the earlier cells it used.

Why a table?

Dynamic programming solves a problem by breaking it into overlapping subproblems and storing each answer so it's computed only once. The table is the stored answers. The tool highlights the current cell in orange and the cells it reads from in light orange, so you can see the recurrence in action:

  • LCS: if the letters match, take the diagonal + 1; otherwise the larger of up and left.
  • Edit distance: if the letters match, copy the diagonal; otherwise 1 + the smallest of replace (diagonal), delete (up) and insert (left).
  • 0/1 knapsack: the better of skipping the item or taking it.
  • Coin change: count the ways by adding each coin's contribution, or find the fewest coins by taking 1 + the best smaller amount.

Worked examples

  • LCS of ABCBDAB and BDCABA: length 4; one LCS is "BCBA", traced back in green.
  • Edit distance from kitten to sitting: 3 (k→s, e→i, add g).
  • Knapsack with weights 1, 3, 4, 5, values 1, 4, 5, 7 and capacity 7: best value 9, taking items 2 and 3.
  • Coin change with coins 1, 2, 5 and amount 11: 11 ways, and the fewest coins is 3 (5 + 5 + 1).

All of these appear in interviews and coding rounds. Seeing the table fill makes the recurrence easy to remember, and tells you the time cost at a glance: rows × columns cells, each O(1).

Frequently asked questions

Why is DP faster than recursion?

Plain recursion solves the same subproblems again and again, often exponentially many times. DP solves each one once and looks it up after that.

Is this top-down or bottom-up?

Bottom-up (tabulation): the table fills from the smallest subproblems. Top-down memoisation gives the same answers.

Why are inputs limited in size?

So the table fits on screen. The same method scales to thousands of cells in code.

Is the dynamic programming table visualizer free to use?

Yes, the dynamic programming table visualizer is free and costs nothing. Filling your first table shows a short form for your name and WhatsApp number one time; once that's done, this tool and every other Uncodemy tool open with no form.

More free tools

See all free tools