Diagonal Traversal of a Matrix I
Given a 2D matrix of size n*m, the tasks is to print all elements of the given matrix in diagonal order.Example:Input: mat[][] = [[ 1, 2, 3, 4 ], [5, 6, 7, 8 ], [9, 10, 11, 12], [13, 14, 15, 16], [17, 18, 19, 20]]Output: 1 5 2 9 6 3 13 10 7 4 17 14 11 8 18 15 12 19 16 20 Using Line by Line Diagonal