Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 27 additions & 0 deletions 0224LJH/202511/14 PGM 최솟값 만들기
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
```java
import java.io.*;
import java.util.*;

class Solution
{
public int solution(int []A, int []B)
{

PriorityQueue<Integer> pq = new PriorityQueue<>();
PriorityQueue<Integer> rPq = new PriorityQueue<>(Collections.reverseOrder());
for (int n: A){
pq.add(n);
}
for (int n: B){
rPq.add(n);
}

int ans = 0;
for (int i = 0; i < A.length; i++){
ans += pq.poll() * rPq.poll();
}

return ans;
}
}
```