Skip to content

Commit d2202ae

Browse files
committed
Runtime: 72 ms (Top 44.52%) | Memory: 128.2 MB (Top 22.61%)
1 parent 6b4e875 commit d2202ae

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

scripts/algorithms/F/Find K Pairs with Smallest Sums/Find K Pairs with Smallest Sums.java

+3-2
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
// Runtime: 72 ms (Top 44.52%) | Memory: 128.2 MB (Top 22.61%)
12
class Solution {
23
public List<List<Integer>> kSmallestPairs(int[] nums1, int[] nums2, int k) {
34
PriorityQueue<int []> pq = new PriorityQueue<>(
@@ -6,7 +7,7 @@ public List<List<Integer>> kSmallestPairs(int[] nums1, int[] nums2, int k) {
67
for(int i = 0; i < nums1.length && i < k; i++){
78
pq.add(new int[]{nums1[i], nums2[0], 0});
89
}
9-
10+
1011
List<List<Integer>> res = new ArrayList<>();
1112
for(int i = 0; i < k && !pq.isEmpty(); i++){
1213
int [] curr = pq.poll();
@@ -18,4 +19,4 @@ public List<List<Integer>> kSmallestPairs(int[] nums1, int[] nums2, int k) {
1819
}
1920
return res;
2021
}
21-
}
22+
}

0 commit comments

Comments
 (0)