728x90
반응형
SMALL

function solution(clothes) {
const map = {};
clothes.forEach(([cloth, type])=>{
map[type] = (map[type] || 0) + 1;
})
const possibility= Object.values(map).reduce((acc,cur)=>{
return acc * (cur+1);
},1)
return possibility-1
}
LIST
'CS > 알고리즘' 카테고리의 다른 글
| [완전탐색] PGS lv2.피로도 (0) | 2025.09.15 |
|---|---|
| [Summer/Winter Coding(~2018)] PGS lv2. 점프와 순간이동 (0) | 2025.09.15 |
| [연습문제] PGS lv2. 행렬의 곱셈 (0) | 2025.09.14 |
| [연습문제] PGS lv1. 가장 가까운 같은 글자 (0) | 2025.09.10 |
| [해시] PGS lv2. 전화번호 목록 (0) | 2025.09.10 |