We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
2 parents a5c87aa + 8b224b0 commit d14d591Copy full SHA for d14d591
suyeun84/202509/11 PGM LV2 시소 짝꿍.md
@@ -0,0 +1,23 @@
1
+```java
2
+import java.util.*;
3
+class Solution {
4
+ public long solution(int[] weights) {
5
+ long answer = 0;
6
+ Arrays.sort(weights);
7
+ Map<Double, Integer> map = new HashMap<>();
8
+ for(int i : weights) {
9
+ double a = i*1.0;
10
+ double b = (i*2.0)/3.0;
11
+ double c = (i*1.0)/2.0;
12
+ double d = (i*3.0)/4.0;
13
+ if(map.containsKey(a)) answer += map.get(a);
14
+ if(map.containsKey(b)) answer += map.get(b);
15
+ if(map.containsKey(c)) answer += map.get(c);
16
+ if(map.containsKey(d)) answer += map.get(d);
17
+ map.put((i*1.0), map.getOrDefault((i*1.0), 0)+1);
18
+ }
19
+
20
+ return answer;
21
22
+}
23
+```
0 commit comments