Z38
Edit Distance (Levenshtein)
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) -> intInput & 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çerirExample Execution Walkthrough
kelime1 = 'horse', kelime2 = 'ros'
horse -> rorse (h->r) -> rose (r sil) -> ros (e sil) -> 3 işlem
cevap: 3Example Test Scenarios (3)
Example 1
Input:
["horse","ros"]Expected Output:
3Example 2
Input:
["intention","execution"]Expected Output:
5Example 3: Boş Metin
Input:
["","a"]Expected Output:
1