프로그래머스8 [Algorithm] 5월 31일 알고리즘 연습 Lv. 1 완주하지 못한 선수 - 오래 걸림 (여러 시행착오) 복습할 내용 : HashMap 사용법 containsKey() keySet() get() put() import java.io.*; import java.util.*; class Solution { public String solution(String[] participant, String[] completion) { String answer = ""; HashMap dupMap = new HashMap(); for(String st : participant){ //동명이인이 이미 존재한다면 int num = 0; if(dupMap.containsKey(st)){ num = dupMap.get(st); } dupMap.put(st,num + .. 2022. 6. 1. 이전 1 2 다음 728x90