```
int minimumTotal(vector<vector<int>>& triangle) {
if(triangle.size()==0) return 0;
vector<int> m = triangle.back();
int i = (int)triangle.size()-1;
while (--i>=0)
for (int j=0; j<=i; j++)
m[j] = triangle[i][j] + min(m[j],m[j+1]);
return m[0];
}
```