/**

- @param {number[][]} triangle
- @return {number}

*/

var minimumTotal = function(triangle) {

for(var i = triangle.length -2;i>=0;i--){

for(var j = 0; j <= i; j++){

var sum = triangle[i][j]+Math.min(triangle[i+1][j]+triangle[i+1][j+1]);

triangle[i][j] = sum;

}

}

return triangle[0][0];

};