import java.util.*;

class Solution {
    public int solution(String[][] clothes) {
        int answer = 1;
        Map<String, Integer> map = new HashMap<>();
        
        for(int i=0; i<clothes.length; i++) { map.put(clothes[i][1], 1); }
        for(int i=0; i<clothes.length; i++) {
            int value = map.get(clothes[i][1])+1;
            map.put(clothes[i][1], value);
        }
        
        for(int i : map.values()) { answer *= i; }
        
        return answer-1;
    }
}

'Problem Solving > Programmers' 카테고리의 다른 글

[Level 2] H-Index  (0) 2022.04.06
[Level 2] 다리를 지나는 트럭  (0) 2022.04.06
[Level 2] 괄호 회전하기  (0) 2022.04.06
[Level 2] 예상 대진표  (0) 2022.04.06
[Level 2] 조이스틱  (0) 2022.03.31