Easy C++ Solution with O(K) Space


#1
#define ll long long
vector<int> Solution::getRow(int A) {

    ll up=A,down=1LL;
    vector<int>ans;
    ll cnt=1;
    ans.push_back(1);
    for(int i=1;i<A;i++)
    {
        cnt*=up;
        cnt/=down;
        ans.push_back(cnt);
        up--;down++;
    }
    if(A!=0)
    ans.push_back(1);
    return ans;
    
}