Skip to content

Commit c84515c

Browse files
authored
Update Kth Smallest Element in a Sorted Matrix.java
1 parent 759fd3a commit c84515c

File tree

1 file changed

+1
-5
lines changed

1 file changed

+1
-5
lines changed

Medium/Kth Smallest Element in a Sorted Matrix.java

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,7 @@
11
class Solution {
22
public int kthSmallest(int[][] matrix, int k) {
33
int numOfRows = matrix.length;
4-
PriorityQueue<int[]> pq = new PriorityQueue<>(new Comparator<int[]>(){
5-
public int compare(int[] o1, int[] o2) {
6-
return o1[2] - o2[2];
7-
}
8-
});
4+
PriorityQueue<int[]> pq = new PriorityQueue<>((o1, o2) -> o1[2] - o2[2]);
95
for (int j = 0; j < numOfRows; j++) {
106
pq.add(new int[]{0, j, matrix[0][j]});
117
}

0 commit comments

Comments
 (0)