leetcode
1329. Sort the Matrix Diagonally
Solution code
k = min(n, m)
Time complexity: O((n + m) k*log(k))
Space complexity: O(k)