Run Code
|
API
|
Code Wall
|
Misc
|
Feedback
|
Login
|
Theme
|
Privacy
|
Patreon
kth smallest element in a matrix
int kthSmallest(int mat[MAX][MAX], int n, int k) { //Your code here priority_queue<int>pq; for(int i=0;i<n;i++) { for(int j=0;j<n;j++) { pq.push(mat[i][j]); if(pq.size()>k) { pq.pop(); } } } return pq.top(); }
run
|
edit
|
history
|
help
0
2
Khadijah Alshehhi
ddd
BindWithContainer
Sliding Game
finding factor
figa gratis
Test 12(2021)
Estocasticos V1.1
Zahra_matrix