모자의 경우의 수 : A모자 착용, B모자 착용, 모자 착용 X (3경우)
안경의 경우의 수 : C안경 착용, 안경 착용 X (2경우)
모자와 안경을 합한 경우의 수 = 3 * 2 = 6가지
import java.util.*;
class Solution {
public int solution(String[][] clothes) {
int answer = 1;
Map<String, Integer> hashmap = new HashMap<String, Integer>();
for(int i=0; i<clothes.length; i++)
hashmap.put(clothes[i][1], hashmap.getOrDefault(clothes[i][1], 0) + 1);
for(int i : hashmap.values())
answer *= (i + 1);
return answer - 1;
}
}