Statement▼
Find the kth smallest element in an (n×n) matrix, where each row and column of the matrix is sorted in ascending order.
Although there can be repeating values in the matrix, each element is considered unique and, therefore, contributes to calculating the kth smallest element.
Constraints:
n
==matrix.length
n
==matrix[i].length
- 1≤
n
≤100 - −103≤
matrix[i][j]
≤103 - 1≤
k
≤n2