【leetcode】120. 三角形最小路径和

 

#define min(a,b) ((a)<(b))?(a):(b)
int minimumTotal(int** triangle, int triangleSize, int* triangleColSize){
    for (int i=triangleSize-2; i>=0; i--)
        for (int j=triangleColSize[i]-1; j>=0; j--)
            triangle[i][j]+=min(triangle[i+1][j+1],triangle[i+1][j]);
    return **triangle;
}

 

posted @ 2020-12-18 12:08  温暖了寂寞  阅读(76)  评论(0编辑  收藏  举报