https://school.programmers.co.kr/learn/courses/30/lessons/42578
import java.util.*;
class Solution {
public int solution(String[][] clothes) {
int answer = 1;
HashMap<String, Integer> hmap = new HashMap<>();
for (int i=0; i<clothes.length; i++) {
hmap.put(clothes[i][1], hmap.getOrDefault(clothes[i][1], 0) + 1);
}
for (String key : hmap.keySet()) {
answer *= (hmap.get(key) + 1);
}
answer--; // 아무것도 입지 않는 경우
return answer;
}
}
A그룹의 원소가 a개, B그룹의 원소가 b개 있으면 조합의 수는 ab
-> A그룹에서만 선택하거나 B그룹에서만 선택하는 경우에는 (a+1)(b+1)