Best Python Solution


#1
def minimumTotal(self, a):
    
    for i in range(1, len(a)) :
        for j in range(len(a[i])) :
            if j == 0 :
                a[i][j] += a[i-1][j]
            elif j == len(a[i])-1 :
                a[i][j] += a[i-1][j-1]
            else :
                a[i][j] += min(a[i-1][j-1], a[i-1][j])

    return min(a[len(a)-1])