Print Diagonally

PHOTO EMBED

Sat Nov 12 2022 10:28:26 GMT+0000 (Coordinated Universal Time)

Saved by @Ranjan_kumar #c++

class Solution{
	public:
	vector<int> downwardDigonal(int n, vector<vector<int>> a)
	{
	    vector<int> v;
		for(int j=0;j<n;j++)
		{
		    int i=0,k=j;
		    while(i<n && k>=0)
		    {
		        v.push_back(a[i][k]);
		        i++;
		        k--;
		    }
		}
		for(int i=1;i<n;i++)
		{
		    int j=i,k=n-1;
		    while(j<n && k>=0)
		    {
		        v.push_back(a[j][k]);
		        j++;
		        k--;
		    }
		}
		return v;
	}
};
content_copyCOPY

https://practice.geeksforgeeks.org/problems/print-diagonally4331/1