Map (1) 썸네일형 리스트형 [프로그래머스 고득점 Kit Lv.2] 해시 - 의상(Java) (+ HashMap 사용법 정리) 📌 문제 📌 코드 import java.util.*; class Solution { public int solution(String[][] clothes) { // clothes 크기 만큼의 map 생성 HashMap map = new HashMap(clothes.length); // clothes[i][0] : 의상 이름, clothes[i][1] : 의상 종류 for (String[] cloth : clothes) { if (map.containsKey(cloth[1])) { // map에 해당 의상 종류가 있으면 실행 map.put(cloth[1], map.get(cloth[1]) + 1); // 그 전 value에 +1 continue; } map.put(cloth[1], 1); // map에 해.. 이전 1 다음