Solving Diagonal Traverse in go. Please try yourself first to solve the problem and submit your implementation to LeetCode before looking into solution.

Problem Description

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.


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

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



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

See the full details of the problem Diagonal Traverse at LeetCode

Originally posted at: