C++ simple O(n) space & time complexity solution


#1
int KC0 = 1;        //k(COMBINATION)0 = select 0 from k candidates

vector<int> toReturn;
toReturn.push_back(KC0);

if(A==0)
    return toReturn;

int numerator = A, denomintor = 1;

for(int i = 1; i <= A-1; i++){
    toReturn.push_back((toReturn[i-1] * numerator)/denominator);
    numerator--;
    denominator++;
}

toReturn.push_back(1);

return toReturn;