标签:log col ota uri int 代码 return href etc
题目思路
健身回来再写 哈哈 反正没人看我的博客
class Solution
{
public:
int minimumTotal(vector<vector<int>>& triangle)
{
int row = triangle.size();
int col = triangle[row - 1].size();
vector<vector<int>> dp(row,vector<int>(col));
for (int i = 0; i < col; ++i)
{
dp[row - 1][i] = triangle[row - 1][i];
}
for (int i = row - 2; i >= 0; i--)
{
for (int j = 0; j < triangle[i].size(); j++)
{
dp[i][j] = std::min(dp[i + 1][j], dp[i + 1][j + 1]) + triangle[i][j];
}
}
return dp[0][0];
}
};
标签:log col ota uri int 代码 return href etc
原文地址:https://www.cnblogs.com/Manual-Linux/p/12001737.html