We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent f342bd1 commit 4cd14bcCopy full SHA for 4cd14bc
1 file changed
0224LJH/202511/14 PGM 최솟값 만들기
@@ -0,0 +1,27 @@
1
+```java
2
+import java.io.*;
3
+import java.util.*;
4
+
5
+class Solution
6
+{
7
+ public int solution(int []A, int []B)
8
+ {
9
10
+ PriorityQueue<Integer> pq = new PriorityQueue<>();
11
+ PriorityQueue<Integer> rPq = new PriorityQueue<>(Collections.reverseOrder());
12
+ for (int n: A){
13
+ pq.add(n);
14
+ }
15
+ for (int n: B){
16
+ rPq.add(n);
17
18
19
+ int ans = 0;
20
+ for (int i = 0; i < A.length; i++){
21
+ ans += pq.poll() * rPq.poll();
22
23
24
+ return ans;
25
26
+}
27
+```
0 commit comments