Leetcode 498. Diagonal Traverse
Return the elements of an m×n matrix in diagonal (zigzag) order, alternating between up-right and down-left along each diagonal. The core insight is to group cells by their i+j diagonal index and reverse every other group to produce the alternating traversal while handling boundary lengths.
Asked at:
Meta
Question Timeline
See when this question was last asked and where, including any notes left by other candidates.
Early October, 2025
Meta
Mid-level
Mid August, 2025
Meta
Senior
Mid April, 2025
Meta
Mid-level
Your account is free and you can post anonymously if you choose.