Edit Distance Problem

Edit Distance Problem — ExecCode Medium DSA Practice

Solve the Edit Distance problem on ExecCode. Free online medium DSA practice in Data Structures and Algorithms. Write and run code in Java, C++, Python — no signup required to run.

Problem description

Given two strings word1 and word2, return the minimum number of operations to convert word1 to word2 (insert, delete, replace).

Examples

Input word1 = "horse", word2 = "ros"; Output 3. Input word1 = "intention", word2 = "execution"; Output 5. Input word1 = "", word2 = "a"; Output 1

Constraints

0 ≤ word1.length, word2.length ≤ 500

Practice Edit Distance free on ExecCode. Browse DSA problems, topic map, and placement guides.