import java.util.*;
class Solution {
    public String solution(String[] participant, String[] completion) {
       String answer = "";
	    Arrays.sort(participant);
	    Arrays.sort(completion);
	    HashMap<String,Integer> map=new HashMap<>();	
	    for(String x:completion) {
		    map.put(x, map.getOrDefault(x, 0)+1);
	    }
	    for(String key: participant) {
		    if(!map.containsKey(key)||map.get(key)==0) {
			    answer=key;
			    System.out.println(answer);
	    	}else if(map.containsKey(key)) {
		    	map.put(key, map.get(key)-1);
		    }
	    }
        return answer;
    }
}

이건 시간초과 떴습니다..

'프로그래머스 코딩테스트' 카테고리의 다른 글

타겟 넘버  (0) 2023.02.25
위장  (0) 2023.02.24
전화번호 목록  (0) 2023.02.23
폰켓몬  (0) 2023.02.23
K번째수  (0) 2023.02.22

+ Recent posts