Skip to content

Commit 10b904f

Browse files
authored
Merge pull request #1419 from AlgorithmWithGod/LiiNi-coder
[20251115] PGM / LV2 / 의상 / 이인희
2 parents ab8f9c2 + 3dbab61 commit 10b904f

File tree

1 file changed

+21
-0
lines changed

1 file changed

+21
-0
lines changed
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
```java
2+
import java.util.*;
3+
4+
class Solution {
5+
public int solution(String[][] clothes) {
6+
Map<String, Integer> countByType = new HashMap<>();
7+
for (String[] cloth : clothes) {
8+
String type = cloth[1];
9+
countByType.put(type, countByType.getOrDefault(type, 0) + 1);
10+
}
11+
int combinations = 1;
12+
for (int count : countByType.values()) {
13+
combinations *= (count + 1);
14+
}
15+
combinations -= 1;
16+
17+
return combinations;
18+
}
19+
}
20+
21+
```

0 commit comments

Comments
 (0)