Tap here to switch tabs
Problem
Submissions

Problem: Sort the Matrix Diagonally

Sort the Matrix Diagonally asks you to arrange every top-left to bottom-right diagonal of a rectangular integer matrix in ascending order, then return the updated matrix.

Statement

A matrix diagonal is a diagonal line of cells starting from some cell in either the topmost row or leftmost column and going in the bottom right direction until reaching the edge of the matrix.

Given an m×nm \times n integer matrix mat, sort each matrix diagonal in ascending order and return the resulting matrix.

Constraints:

  • m ==== mat.length

  • n ==== mat[i].length

  • 1≤1 \leq m, n ≤100\leq 100

  • 1≤1 \leq mat[i][j] ≤100\leq 100

⋮
Tap here to switch tabs
Problem
Submissions

Problem: Sort the Matrix Diagonally

Sort the Matrix Diagonally asks you to arrange every top-left to bottom-right diagonal of a rectangular integer matrix in ascending order, then return the updated matrix.

Statement

A matrix diagonal is a diagonal line of cells starting from some cell in either the topmost row or leftmost column and going in the bottom right direction until reaching the edge of the matrix.

Given an m×nm \times n integer matrix mat, sort each matrix diagonal in ascending order and return the resulting matrix.

Constraints:

  • m ==== mat.length

  • n ==== mat[i].length

  • 1≤1 \leq m, n ≤100\leq 100

  • 1≤1 \leq mat[i][j] ≤100\leq 100