Dynamic Programming pattern

Edit Distance

Given two strings word1 and word2, return the minimum number of operations (insert, delete, or replace a character) required to convert word1 into word2. Watch it run step by step, then write your own pseudocode and get it checked by AI.

  • LeetCode 72
  • Hard
  • 1 approach

Sign in with Google or GitHub and you land straight on this page. DSA comes with the all labs plan and every ChaiCode batch.

Dynamic ProgrammingLeetCode 72

Hard

The approach

  1. 01 2-D tabulation O(m·n)O(m·n) space
Played step by step, with its time and space.

What you will learn

  • How to read Edit Distance and spot the dynamic programming pattern in it
  • 2-D tabulation: O(m·n) time, O(m·n) space
  • The pseudocode for each approach, its line lit as the animation runs
  • Practice: write your own pseudocode and get it checked

More Dynamic Programming

See Edit Distance run, step by step

Sign in and this page opens on the animation, with all 18 Dynamic Programming problems beside it.

DSA comes with the all labs plan and every ChaiCode batch.