This is my code for triangle problem:

```
class Solution {
public:
int min(int a, int b ){
if( a<b) return a;
return b;
}
int minimumTotal(vector<vector<int> > &triangle) {
if( triangle.size() == 1 ) return triangle[0][0];
int i, j, left, top, minSum = INT_MAX, height = triangle.size(), width;
for( i=1; i<height; i++){
width = triangle[i].size();
for( j=0; j<width; j++){
left = (j>0)? triangle[i-1][j-1]: INT_MAX;
top = triangle[i-1][j-1];
triangle[i][j] += min(top, left);
}
}
width = triangle[height-1].size();
for( i=0; i<width; i++){
if( minSum > triangle[height-1][i])
minSum = triangle[height-1][i];
}
return minSum;
}
};
```

For the input:

[[1],[2,3]]

the output given by the program is 4. The correct answer is 3. However, the code works on my machine. What is going wrong?