Python3 - No extra space :)


#1
class Solution:
    # @param A : list of list of integers
    # @return an integer
    def solve(self, A):
        
        m=A[0][0]

        
        for i in range(1,len(A)):
            fl=0
            for j in range(len(A[i])):
                if j==0:
                    A[i][j]=A[i-1][j]+A[i][j]
                elif j==i:
                    A[i][j]=A[i-1][j-1]+A[i][j]
                    fl=1
                else:
                    A[i][j]=max(A[i-1][j]+A[i][j],A[i-1][j-1]+A[i][j])
                m=max(A[i][j],m)
                if fl:
                    break
        
        return m