109. Kth Smallest Element in a Sorted Matrix

Find the k-th smallest element in a matrix where each row and each column is sorted in ascending order.
Example 1
Input: matrix = [[1,5,9],[10,11,13],[12,13,15]], k = 8
Output: 13
Explanation: The 8th largest element in the sorted matrix is 13.
Example 2
Input: matrix = [[-5]], k = 1
Output: -5
Explanation: The only element in a 1×1 matrix.
arraysheapmedium
JavaScript
Loading...
Line 1, Char 1