<qiyuangong>072_Edit_Distance_1.py
def minDistance( word1, word2):
    ls_1, ls_2 = len(word1), len(word2)
    dp = [[0] * (ls_2 + 1) for _ in range(ls_1 + 1)]
    for i in range(1, ls_1 + 1):
        dp[i][0] = i
    for j in range(1, ls_2 + 1):
        dp[0][j] = j
    for i in range(1, ls_1 + 1):
        for j in range(1, ls_2 + 1):
            if word1[i - 1] == word2[j - 1]:
                dp[i][j] = dp[i - 1][j - 1]
            else:
                dp[i][j] = min(dp[i - 1][j - 1] + 1,
                               dp[i][j - 1] + 1,
                               dp[i - 1][j] + 1)
    return dp[ls_1][ls_2]
def sample_funcname ( var_0 , var_1 ) :
    var_3 , var_4 = len ( var_0 ) , len ( var_1 )
    var_9 = [ [ 0 ] * ( var_4 + 1 ) for var_7 in range ( var_3 + 1 ) ]
    for var_10 in range ( 1 , var_3 + 1 ) :
        var_9 [ var_10 ] [ 0 ] = var_10
    for var_11 in range ( 1 , var_4 + 1 ) :
        var_9 [ 0 ] [ var_11 ] = var_11
    for var_10 in range ( 1 , var_3 + 1 ) :
        for var_11 in range ( 1 , var_4 + 1 ) :
            if var_0 [ var_10 - 1 ] == var_1 [ var_11 - 1 ] :
                var_9 [ var_10 ] [ var_11 ] = var_9 [ var_10 - 1 ] [ var_11 - 1 ]
            else :
                var_9 [ var_10 ] [ var_11 ] = min ( var_9 [ var_10 - 1 ] [ var_11 - 1 ] + 1 , var_9 [ var_10 ] [ var_11 - 1 ] + 1 , var_9 [ var_10 - 1 ] [ var_11 ] + 1 )
    return var_9 [ var_3 ] [ var_4 ]
