Back to course home
0% completed
Solution: Kth Smallest Number in a Sorted Matrix
Problem Statement
Given an N * N matrix where each row and column is sorted in ascending order, find the Kth smallest element in the matrix.
Example 1:
Input: Matrix=[
[2, 6, 8],
[3, 7, 10],
[5, 8, 11]
],
K=5
Output: 7
Explanation: The 5th smallest number in the matrix is 7.
Constraints:
n == matrix.length == matrix[i].length
1 <= n <= 300
- -10<sup>9</sup> <= matrix[i][j] <= 10<sup>9</sup>
- All the rows and columns of matrix are guaranteed to be sorted in non-decreasing order.
- 1 <= k <= n<sup>2</sup>
.....
.....
.....
Like the course? Get enrolled and start learning!
Table of Contents
Contents are not accessible
Contents are not accessible
Contents are not accessible
Contents are not accessible
Contents are not accessible