Skip to content

Commit ae5a4d5

Browse files
authored
[20251023] PGM / LV2 / 최솟값 만들기 / 이인희
1 parent a6255d8 commit ae5a4d5

File tree

1 file changed

+26
-0
lines changed

1 file changed

+26
-0
lines changed
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
```java
2+
import java.util.*;
3+
4+
class Solution
5+
{
6+
public int solution(int []A, int []B)
7+
{
8+
int answer = 0;
9+
List<Integer> a = new ArrayList<>();
10+
for(int i: A){
11+
a.add(i);
12+
}
13+
List<Integer> b = new ArrayList<>();
14+
for(int i: B){
15+
b.add(i);
16+
}
17+
Collections.sort(a);
18+
Collections.sort(b, Collections.reverseOrder());
19+
for(int i = 0; i<A.length; i++)
20+
answer += a.get(i)*b.get(i);
21+
22+
23+
return answer;
24+
}
25+
}
26+
```

0 commit comments

Comments
 (0)