Skip to content

Commit 7ae53a0

Browse files
committed
85차 3번 문제풀이
1 parent 7fced5d commit 7ae53a0

1 file changed

Lines changed: 15 additions & 0 deletions

File tree

live8/test85/문제3/이상민.js

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
function solution(clothes) {
2+
let answer = 1;
3+
const map = new Map();
4+
for (const cloth of clothes) {
5+
const [name, type] = cloth;
6+
if (!map.has(type)) map.set(type, 1);
7+
else map.set(type, map.get(type) + 1);
8+
}
9+
10+
for (const key of map.keys()) {
11+
answer *= map.get(key) + 1;
12+
}
13+
14+
return answer - 1;
15+
}

0 commit comments

Comments
 (0)