classSolution:defminimumDeleteSum(self,s1:str,s2:str) ->int: n, m =len(s1),len(s2) dp = [[0] * (m +1) for _ inrange(n +1)]for i inrange(1, n +1):for j inrange(1, m +1):if s1[i -1]== s2[j -1]: dp[i][j] = dp[i -1][j -1] +ord(s1[i -1])else: dp[i][j] =max(dp[i -1][j], dp[i][j -1])returnsum([ord(c) for c in s1])+sum([ord(c) for c in s2])-2* dp[-1][-1]