Last Updated: 17 Mar, 2018

Print Diagonal

Easy
Asked in company
ZS

Problem statement

Given a 2D matrix, print all elements of the given matrix in diagonal order.

See the sample input.

Input format :
Line 1 : Number of rows R and cols C in the matrix
Line 2 : RXC elements of the matrix separated by space
Output Format :
 Print the diagonals
Constraints :
 1 <= R <= 10^3
 1 <= C <= 10^3