```
class Solution {
public:
int minimumTotal(vector<vector<int>>& triangle) {
int size = triangle.size();
for (int i = 1; i < size; ++i) {
for (int j = 1; j < i; ++j) {
triangle[i][j] += min(triangle[i - 1][j - 1], triangle[i - 1][j]);
}
triangle[i][0] += triangle[i - 1][0];
triangle[i][i] += triangle[i - 1][i - 1];
}
return *min_element(triangle[size - 1].begin(), triangle[size - 1].end());
}
};
```