Given an index k, return the kth row of the Pascal’s triangle.
class Solution {
public:
vector<int> getRow(int rowIndex) {
vector<int> ANS;
ANS.push_back(1);
long long ans = 1, a = rowIndex, b = 1;
while(a >=1 )
{
ans *= a;
ans /= b;
a--; b++;
ANS.push_back((int)ans);
}
return ANS;
}
};