Easy C++ Solution, in 0(K) space complexity


#1

vector Solution::getRow(int A) {

vector<int> res = {1};

for(int r = 1; r <= A; r++)
{
    for(int pos=res.size() - 1; pos > 0; pos--)
        res[pos] += res[pos-1];
    res.push_back(1);
}

return res;

}


#2

this can be done in linear complexity.


#3

very nice solution, both in time and place complexity :slight_smile: