import java.util.*;
class Solution {
public int solution(String[][] clothes) {
int answer = 0;
HashMap<String,Integer>map=new HashMap<>();
for(int i=0; i<clothes.length; i++){
for(int j=1; j<clothes[i].length; j++){
map.put(clothes[i][1],map.getOrDefault(clothes[i][1], 0)+1);
}
}
int count=1;
for(String x: map.keySet()){
count*=map.get(x)+1 ;
}
answer=count-1;
return answer;
}
}
'프로그래머스 코딩테스트' 카테고리의 다른 글
게임 맵 최단거리 (0) | 2023.02.27 |
---|---|
타겟 넘버 (0) | 2023.02.25 |
전화번호 목록 (0) | 2023.02.23 |
완주하지 못한 선수 (0) | 2023.02.23 |
폰켓몬 (0) | 2023.02.23 |