题目:
题解:
int minimumTotal(int** triangle, int triangleSize, int* triangleColSize) {int f[triangleSize];memset(f, 0, sizeof(f));f[0] = triangle[0][0];for (int i = 1; i < triangleSize; ++i) {f[i] = f[i - 1] + triangle[i][i];for (int j = i - 1; j > 0; --j) {f[j] = fmin(f[j - 1], f[j]) + triangle[i][j];}f[0] += triangle[i][0];}int ret = f[0];for (int i = 1; i < triangleSize; i++) ret = fmin(ret, f[i]);return ret;
}