Skip to content

Latest commit

 

History

History
executable file
·
29 lines (19 loc) · 537 Bytes

File metadata and controls

executable file
·
29 lines (19 loc) · 537 Bytes

题目

Given a matrix of M x N elements (M rows, N columns), return all elements of the matrix in diagonal order as shown in the below image.

Example:

Input:
[
 [ 1, 2, 3 ],
 [ 4, 5, 6 ],
 [ 7, 8, 9 ]
]
Output:  [1,2,4,7,5,3,6,8,9]

Explanation:

pic

Note:

  1. The total number of elements of the given matrix will not exceed 10,000.

解题思路

见程序注释