프로그래머스 위장 java
-
Level2) 위장PS/programmers 2021. 5. 3. 17:54
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 import java.util.*; public class Level2_위장 { public static int solution(String[][] clothes) { Map map = new HashMap(); for (String[] str: clothes) { String key = str[1]; map.put(key, map.getOrDefault(key, 0) + 1); } int answer = 1; for (int value : map.values()) { answer *= (value + 1); } return answer - 1; } public static void ma..