You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Heap: Given a n x n matrix where each of the rows and columns are sorted in ascending order, find the kth smallest element in the matrix in Javascript
#1746
Open
akgmage opened this issue
Oct 15, 2023
· 0 comments
Note that it is the kth smallest element in the sorted order, not the kth distinct element.
Example:
Input:
matrix = [
[ 1, 5, 9],
[10, 11, 13],
[12, 13, 15]
],
k = 8,
Output: 13
Note:
You may assume k is always valid, 1 ≤ k ≤ n^2. You may also assume that 1 <= n <= 1000.
The text was updated successfully, but these errors were encountered:
Note that it is the kth smallest element in the sorted order, not the kth distinct element.
Example:
Input:
matrix = [
[ 1, 5, 9],
[10, 11, 13],
[12, 13, 15]
],
k = 8,
Output: 13
Note:
You may assume k is always valid, 1 ≤ k ≤ n^2. You may also assume that 1 <= n <= 1000.
The text was updated successfully, but these errors were encountered: