230623 의상

Jongleee·2023년 6월 23일
0

TIL

목록 보기
293/576
public int solution(String[][] clothes) {
	HashMap<String, Integer> map = new HashMap<>();

	for (String[] clothe : clothes) {
		String type = clothe[1];
		map.put(type, map.getOrDefault(type, 0) + 1);
	}

	int answer = 1;
	for (int count : map.values()) {
		answer *= (count + 1);
	}

	return answer - 1;
}

출처:https://school.programmers.co.kr/learn/courses/30/lessons/42578

0개의 댓글