class Solution {

public:

```
int minimumTotal(vector<vector<int>>& triangle) {
int n = triangle.size();
//0 ~ n -1
if(n == 0)
return 0;
if(n == 1)
return triangle[0][0];
for(int i = n -2; i >= 0; i --)
{
for(int k = 0; k <= i; k ++)
triangle[i][k] += std::min(triangle[i + 1][k], triangle[i + 1][k + 1]);
}
return triangle[0][0];
}
```

};