Recent Posts
Recent Comments
목록해시맵 (2)
밍쎄의 코딩공간
프로그래머스 LV.1 - 대충 만든 자
import java.util.HashMap; class Solution { public int[] solution(String[] keymap, String[] targets) { HashMap hm = new HashMap(); int[] ret = new int[targets.length]; for(String key : keymap) { for(int i=0 ; i
프로그래머스/프로그래머스 LV.1
2023. 8. 26. 15:59
프로그래머스 LV.1 - 완주하지 못한 선수
import java.util.HashMap; class Solution { public String solution(String[] participant, String[] completion) { String answer =""; HashMap hm = new HashMap(); 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(answ..
프로그래머스/프로그래머스 LV.1
2023. 8. 19. 00:54