Why am I getting TLE


#1

Comment body goevector<vector > Solution::generateMatrix(int A) {
int cnt=1,sr=0,sc=0,lr=A-1,lc=A-1,i,j;

int v[A][A];
int n=pow(A,2);

while(sr<lr && sc<lc)
{
    
    j=sc;
    while(j<=lc)
    {
        v[sr][j]=cnt++;
        
        j++;
    }
    sr++;
    i=sr;
    while(i<=lr)
    {
        v[i][lc]=cnt++;
       
        i++;
    }
    lc--;
    j=lc;
    while(j>=sc)
    {
        v[lr][j]=cnt++;
        
        j--;
    }
    lr--;
    i=lr;
    while(i>=sr)
    {
        v[i][sc]=cnt++;
       
    }
    sc++;
   
    
}
vector<vector<int>>b;
vector<int> c;
for(i=0;i<A;i++)
{c.clear();
for(j=0;j<A;j++)
{
    c.push_back(v[j][i]);
}
    b.push_back(c);
}
return b;

}
s here.