<qiyuangong>072_Edit_Distance_2.py
def minDistance( word1, word2):
    ls_1, ls_2 = len(word1), len(word2)
    dp = list(range(ls_1 + 1))
    for j in range(1, ls_2 + 1):
        pre = dp[0]
        dp[0] = j
        for i in range(1, ls_1 + 1):
            temp = dp[i]
            if word1[i - 1] == word2[j - 1]:
                dp[i] = pre
            else:
                dp[i] = min(pre + 1, dp[i] + 1, dp[i - 1] + 1)
            pre = temp
    return dp[ls_1]
def sample_funcname ( var_0 , var_1 ) :
    var_3 , var_4 = len ( var_0 ) , len ( var_1 )
    var_8 = list ( range ( var_3 + 1 ) )
    for var_9 in range ( 1 , var_4 + 1 ) :
        var_11 = var_8 [ 0 ]
        var_8 [ 0 ] = var_9
        for var_12 in range ( 1 , var_3 + 1 ) :
            var_13 = var_8 [ var_12 ]
            if var_0 [ var_12 - 1 ] == var_1 [ var_9 - 1 ] :
                var_8 [ var_12 ] = var_11
            else :
                var_8 [ var_12 ] = min ( var_11 + 1 , var_8 [ var_12 ] + 1 , var_8 [ var_12 - 1 ] + 1 )
            var_11 = var_13
    return var_8 [ var_3 ]
