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.
Input:
[
['a', 'b', 'c', 'd'],
['e', 'f', 'g', 'h'],
['i', 'j', 'k', 'l'],
]
Return value:
['a', 'b', 'e', 'i', 'f', 'c', 'd', 'g', 'j', 'k', 'h', 'l']