Skip to content
Veltoryx Technologies
ProProblem 148● Mediumleetcode ↗3 min readUpdated 30 October 2026

Edit Distance

Compute the minimum operations to transform one word into another using 2D string alignment dynamic programming.

01The problem

Given two strings word1 and word2, return the minimum number of operations required to convert word1 to word2.

You have the following three operations permitted on a word:

  • Insert a character
  • Delete a character
  • Replace a character

Loading the rest of the lesson…