[프로그래머스/JAVA] 해시 - Lv1 완주하지 못한 선수
·
Computer Science/자료구조와 알고리즘
1. 문제 2. 코드 import java.util.*; class Solution { public String solution(String[] participant, String[] completion) { HashMap hm = new HashMap(); String answer = ""; for(String player : participant) hm.put(player,hm.getOrDefault(player,0)+1); for(String player : completion) hm.put(player,hm.get(player)-1); for(String key : hm.keySet()) if(hm.get(key)!=0){ answer = key; System.out.println(answer);..