3446. Sort Matrix by Diagonals
You are given an
n x n
square matrix of integersgrid
. Return the matrix such that:
- The diagonals in the bottom-left triangle (including the middle diagonal) are sorted in non-increasing order.
- The diagonals in the top-right triangle are sorted in non-decreasing order.
go
1 | package main |