Given numRows, generate the first numRows of Pascal's triangle.
For example, given numRows = 5,
Return
[ [1], [1,1], [1,2,1], [1,3,3,1], [1,4,6,4,1] ]
class Solution { public: vector<vector<int> > generate(int numRows) { vector<vector<int>> ve; vector<int> ve1; if(numRows==0) return ve; ve1.push_back(1); ve.push_back(ve1); if(numRows==1) return ve; ve1.clear(); ve1.push_back(1); ve1.push_back(1); ve.push_back(ve1); if(numRows==2) return ve; int i; int j; for(i=2;i<numRows;i++) { ve1.clear(); ve1.push_back(1); for(j=0;j<i-1;j++) ve1.push_back(ve[i-1][j]+ve[i-1][j+1]); ve1.push_back(1); ve.push_back(ve1); } return ve; } };