return tmpLarge.push_back(tmp);
The price is equal to
tmpLarge.push_back(tmp);return tmpLarge;
Because the push_back () return value type is void, the latter returns the type of Tmplarge.
The code is as follows:
classSolution { Public: vector<vector<int>>GenerateintNumRows) {if(NumRows = =0) { vector<vector<int>>Tmplarge;returnTmplarge; }if(NumRows = =1) { vector<int>tmp vector<vector<int>>Tmplarge; Tmp.push_back (1);//"Return Tmplarge.push_back (TMP);" is ErrorTmplarge.push_back (TMP);returnTmplarge; } vector<vector<int> >Smallresult = Generate (NumRows-1); vector<int>tmp Smallresult.push_back (TMP); Smallresult[numrows-1].push_back (1); for(inti =0; I <= NumRows-3; i++) {smallresult[numrows-1].push_back (Smallresult[numrows-2][i] + smallresult[numrows-2][i +1]); } smallresult[numrows-1].push_back (1);returnSmallresult; }};
Copyright NOTICE: This article for Bo Master original article, without Bo Master permission not reproduced.
Pascal ' s Triangle