public class Solution { public int MinDistance(string word1, string word2) { , word2.Length + ]; ; i <= word1.Length; i++) { ; j <= word2.Length; j++) { || j == ) dp[i, j] = ; ] == word2[j - ]) ? dp[i - , j - ] + : Math.Max(dp[i - , j], dp[i, j - ])…