Skip to content

Commit dc58fe5

Browse files
committed
solve: programmers 위장
- 조합을 통한 풀이
1 parent 5d7db95 commit dc58fe5

1 file changed

Lines changed: 8 additions & 0 deletions

File tree

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
const solution = clothes => {
2+
const clothesObject = clothes.reduce((acc, [name, kind]) => {
3+
acc.hasOwnProperty(kind)? acc[kind] += 1 : acc[kind] = 1;
4+
return acc;
5+
}, new Object());
6+
7+
return Object.values(clothesObject).reduce((acc, val) => acc *= val + 1, 1) - 1;
8+
}

0 commit comments

Comments
 (0)