We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent a9a5603 commit f0473adCopy full SHA for f0473ad
src/TheKWeakestRowsInAMatrix.java
@@ -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