Diagonal traversal of a matrix

0
Remix

Return the elements of a matrix diagonal by diagonal. In one version the direction alternates (up-right, then down-left); in another every diagonal is read in the same direction and the rows may have different lengths. Be ready for both.

MetaCodingLast asked Feb 2026
No answer yet. Write the first one; the best answer gets endorsed.