function solution(clothes) {
const store = {}
for (let cloth of clothes) {
if (cloth[1] in store) {
store[cloth[1]].push(cloth[0])
} else {
store[cloth[1]] = [cloth[0]]
}
}
let answer = 1;
for (let storeKey in store) {
answer *= store[storeKey].length + 1
}
return answer - 1
}
=> 처음 잘못 생각했던 것이 옷을 안 입는 경우 때문에 안 입는 경우 + 나오게 되는 경우의 수로 계산해서 틀림
=> 옷을 안 입는 경우까지 모두 경우의 수로 구한 뒤, 아에 안 입는 케이스 1을 빼야 정답