Easiest solution possible


#1

vector<vector > Solution::diagonal(vector<vector > &A)
{
int n=A.size();
int numb=n+n-1;

vector<vector<int>> arr(numb,vector<int>(0));
for(int y=0;y<n;y++)
{
    for(int x=0;x<n;x++)
    {
        
            arr[x+y].push_back(A[y][x]);
    }
}
return arr;

}


#2

Your solution take O(N) space but questions says constant space complexity