Very short C++ solution without using extra space


#1

int Solution::solve(vector<vector > &A) {
for(int i=A.size()-2;i>=0;i–){
for(int j=0;j<i+1;j++){
A[i][j]+=max(A[i+1][j],A[i+1][j+1]);
}
}
return A[0][0];
}