← All problems

Edit Distance

Hard dynamic programmingstrings LeetCode ↗
Minimum operations (insert, delete, replace) to convert word1 to word2.

Hints (0/3 revealed)

Log in to reveal hints progressively.

Complexity

Time O(mn), Space O(mn) (O(n) optimized)

Common pitfalls

  • Wrong base cases
  • Forgetting replace as a distinct op

Your solution

Log in to save your code and track progress.