Z38

Edit Distance (Levenshtein)

Staff / Principal Engineer
Target Time: 40 - 50 Minutes
Type: NUMERIC

Problem Statement & Objective

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

Function Signature (Python)

min_distance_edit(word1: str, word2: str) -> int

Input & Output Contract

Output Rule:Minimum düzenleme işlem sayısı.

System Constraints

0 <= kelime1.length, kelime2.length <= 500
Metinler küçük İngilizce harfler içerir

Example Execution Walkthrough

kelime1 = 'horse', kelime2 = 'ros'
horse -> rorse (h->r) -> rose (r sil) -> ros (e sil) -> 3 işlem
cevap: 3

Example Test Scenarios (3)

Example 1
Input:["horse","ros"]
Expected Output:3
Example 2
Input:["intention","execution"]
Expected Output:5
Example 3: Boş Metin
Input:["","a"]
Expected Output:1
Loading Python Editor...
Input Parameters
[
  "horse",
  "ros"
]
Expected Output
3