【second】Pascal's Triangle II
vector<int> getRow(int rowIndex) {
// Note: The Solution object is instantiated only once and is reused by each test case.
if(rowIndex<0)
return vector<int>();
vector<int> res(rowIndex+1);
res[0] = 1;
for(int i=1;i<=rowIndex;i++)
{
res[i] = 1;
for(int j=i-1;j>0;j--)
res[j] += res[j-1];
res[0] = 1;
}
return res;
}
浙公网安备 33010602011771号