parameters: (self, grid)
return_statement: return mem[-1]
docstring: :type grid: List[List[int]]
          :rtype: int
docstring_summary: :type grid: List[List[int]]
          :rtype: int
docstring_tokens: : type grid : List [ List [ int ]] : rtype : int
function: def minPathSum(self, grid):
          """
          :type grid: List[List[int]]
          :rtype: int
          """
          if not grid:
              return 0
  
          mem = grid[0][:]
          r, c = len(grid), len(grid[0])
          for i in range(1, c):
              mem[i] += mem[i - 1]
          for j in range(1, r):
              mem[0] += grid[j][0]
              for i in range(1, c):
                  mem[i] = min(mem[i - 1], mem[i]) + grid[j][i]
  
          return mem[-1]
function_tokens: def minPathSum ( self , grid ) : if not grid : return 0 mem = grid [ 0 ] [ : ] r , c = len ( grid ) , len ( grid [ 0 ] ) for i in range ( 1 , c ) : mem [ i ] += mem [ i - 1 ] for j in range ( 1 , r ) : mem [ 0 ] += grid [ j ] [ 0 ] for i in range ( 1 , c ) : mem [ i ] = min ( mem [ i - 1 ] , mem [ i ] ) + grid [ j ] [ i ] return mem [ - 1 ]