Here is my solution in O(k) space and O(k) time

but I failed in precision problems . (especially for the case larger than 30)

can anyone help?

```
public:
vector<int> getRow(int rowIndex) {
double f=1,n=1;
vector<int> res;
res.push_back(1);
for(int i = 0; i < (rowIndex+1)/2; i++)
{
f *= rowIndex - i;
n *= i + 1;
res.push_back(int(f/n));
cout << f/n << endl;
}
for(int i = (rowIndex/2) -1 ; i >= 0; i--)
{
res.push_back(res.at(i));
}
return res;
}
};
```