Space Complexity constraints are absurdly followed


#1

I am attaching my code snippet which does not pass system tests because I am using O(k+3) space and hence it is getting violated when A=2.
Isn’t this absurd because space complexity O(k) will be followed when k is large(and it should be seen when k is large, not when it is small because there is no meaning of asymptotic analysis when inputs are small).
I hope they revise their criteria.

Code Snippet

vector Solution::getRow(int A) {
vectorv;
long long p,k,m;
for(int i=0;i<=A;i++)
{
p=1;
k=1;
if(A-i<i)
i=A-i;
if (i != 0) {
while (i) {
p *= A;
k *= i;
m = __gcd(p, k);
p /= m;
k /= m;
A–;
i–;
}
}
else
p = 1;
v.push_back§;
}
return v;
}


#2

It is not because of the space you’re using . Checkyour logic again !