diff --git a/200206/honux77/programmers-42576-Solution.java b/200206/honux77/programmers-42576-Solution.java new file mode 100644 index 0000000..4840eba --- /dev/null +++ b/200206/honux77/programmers-42576-Solution.java @@ -0,0 +1,32 @@ +//프로그래머스 완주하지 못한 선수 + +import java.util.HashMap; + +public class Solution { + + public String solution(String[] participant, String[] completion) { + HashMap cmap = new HashMap<>(); + + for (String s: completion) { + Integer n = cmap.get(s); + if (n == null) { + cmap.put(s, 1); + } + else { + n++; + cmap.put(s, n); + } + } + + for (String s: participant) { + Integer n = cmap.get(s); + if(n == null || n == 0) { + return s; + } else { + n--; + cmap.put(s, n); + } + }; + return "Me"; + } +} \ No newline at end of file