Dynamic programming where DP[i][j] tracks min operations to convert word1[:i] to word2[:j]. Match chars cost 0, mismatch takes min(insert, delete, replace=1). Space optimize to O(min(m,n)) with rolling arrays. O(mn) time. Used in spellcheck (Copilot), fuzzy search (Google), DNA alignment.
Output:-
Explanation ("horse" → "ros"):
- Replace 'h' → 'r' (1 op)
- Delete 's' (1 op)
- Delete 'e' (1 op)Total: 3 operations


.png)
