본문 바로가기
CS/알고리즘

[해시] PGS lv2. 의상

by westpearl 2025. 9. 14.
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