0498. Diagonal Traverse

https://leetcode.com/problems/diagonal-traverse

Description

Given an m x n matrix mat, return an array of all the elements of the array in a diagonal order.

Example 1:

Example 2:

Constraints:

  • m == mat.length

  • n == mat[i].length

  • 1 <= m, n <= 104

  • 1 <= m * n <= 104

  • -105 <= mat[i][j] <= 105

ac

Last updated

Was this helpful?