public class Solution {
/**
* @param triangle: a list of lists of integers.
* @return: An integer, minimum path sum.
*/
public int minimumTotal(int[][] triangle) {
// write your code here
int height = triangle.length;
for (int i = height - 2; i >= 0; i--) {
int length = triangle[i].length;
for (int j = 0; j < length; j++) {
triangle[i][j] = triangle[i][j] + Math.min(triangle[i + 1][j],triangle[i + 1][j + 1]);
}
}
return triangle[0][0];
}
}