← All problemsSign in

3446. Sort Matrix by Diagonals

LeetCodeArraySortingMatrixOpen on judge ↗

You are given an n x n square matrix of integers grid. 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. Example 1: Input: grid = [[1,7,3],[9,8,2],[4,5,6]] Output: [[8,2,3],[9,6,7],[4,5,1]] Explanation: The diagonals with

HINT LADDERno hints yet
L1 Observation
L2 Technique
L3 Approach
L4 Pseudo-code
🔒
L5 Full solution
L5 unlocks only if you insist twice
solution.cppC++17

CodeSearch Tutor

Hints, not spoilers — it won’t hand over the full solution unless you insist.

voice by Sarvam AI

Sign in to chat with the tutor and save your progress.

Sign in to start