class Solution {
public:
vector<vector<int>> generate(int numRows)
{
vector<vector<int>> ret;
if(numRows == 0)
{
return ret;
}
vector<int> tmp;
int array[numRows][numRows];
memset(array, 0, numRows*numRows*4);
int i = 0;
int j = 0;
for(i=0; i<numRows; i++)
{
array[i][0] = 1;
array[i][i] = 1;
}
for(i=2; i<numRows; i++)
{
for(j=1; j<i; j++)
{
array[i][j] = array[i-1][j] + array[i-1][j-1];
}
}
//vector<float> vecHeight(arrHeight, arrHeight+sizeof(arrHeight)/sizeof(float));
for(i=0; i<numRows; i++)
{
vector<int> vecHeight;
for(j=0; j<i+1; j++)
{
vecHeight.push_back(array[i][j]);
}
ret.push_back(vecHeight);
}
return ret;
}
};