Skip to content

Commit f0473ad

Browse files
a
1 parent a9a5603 commit f0473ad

File tree

1 file changed

+26
-0
lines changed

1 file changed

+26
-0
lines changed

src/TheKWeakestRowsInAMatrix.java

+26
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
import java.util.PriorityQueue;
2+
import java.util.Queue;
3+
4+
public class TheKWeakestRowsInAMatrix {
5+
public int[] kWeakestRows(int[][] mat, int k) {
6+
Queue<Row> minHeap = new PriorityQueue<>();
7+
for (int[] row: mat) {
8+
minHeap.add()
9+
}
10+
}
11+
12+
private record Row(int index, int soldiers) implements Comparable<Row> {
13+
14+
@Override
15+
public int compareTo(Row other) {
16+
if (this.soldiers == other.soldiers) {
17+
return Integer.compare(this.index, other.index);
18+
}
19+
return Integer.compare(this.soldiers, other.soldiers);
20+
}
21+
22+
private static Row from(int[] row, int index) {
23+
for (int)
24+
}
25+
}
26+
}

0 commit comments

Comments
 (0)