<doocs>0064.Minimum Path Sum_1.py
def minPathSum( grid: List[List[int]]) -> int:
    m, n = len(grid), len(grid[0])
    dp = [[grid[0][0]] * n for _ in range(m)]
    for i in range(1, m):
        dp[i][0] = dp[i - 1][0] + grid[i][0]
    for j in range(1, n):
        dp[0][j] = dp[0][j - 1] + grid[0][j]
    for i in range(1, m):
        for j in range(1, n):
            dp[i][j] = min(dp[i - 1][j], dp[i][j - 1]) + grid[i][j]
    return dp[-1][-1]
def sample_funcname ( var_0 : List [ List [ int ] ] ) -> int :
    var_4 , var_6 = len ( var_0 ) , len ( var_0 [ 0 ] )
    var_9 = [ [ var_0 [ 0 ] [ 0 ] ] * var_6 for var_7 in range ( var_4 ) ]
    for var_11 in range ( 1 , var_4 ) :
        var_9 [ var_11 ] [ 0 ] = var_9 [ var_11 - 1 ] [ 0 ] + var_0 [ var_11 ] [ 0 ]
    for var_12 in range ( 1 , var_6 ) :
        var_9 [ 0 ] [ var_12 ] = var_9 [ 0 ] [ var_12 - 1 ] + var_0 [ 0 ] [ var_12 ]
    for var_11 in range ( 1 , var_4 ) :
        for var_12 in range ( 1 , var_6 ) :
            var_9 [ var_11 ] [ var_12 ] = min ( var_9 [ var_11 - 1 ] [ var_12 ] , var_9 [ var_11 ] [ var_12 - 1 ] ) + var_0 [ var_11 ] [ var_12 ]
    return var_9 [ - 1 ] [ - 1 ]
