收声啦!# Joke - 肚皮舞运动
v*o
1 楼
Given a 2D matrix, print all elements of the given matrix in diagonal order.
For example, consider the following 5 X 4 input matrix.
1 2 3 4
5 6 7 8
9 10 11 12
13 14 15 16
17 18 19 20
Diagonal printing of the above matrix is
1
5 2
9 6 3
13 10 7 4
17 14 11 8
18 15 12
19 16
20
For example, consider the following 5 X 4 input matrix.
1 2 3 4
5 6 7 8
9 10 11 12
13 14 15 16
17 18 19 20
Diagonal printing of the above matrix is
1
5 2
9 6 3
13 10 7 4
17 14 11 8
18 15 12
19 16
20