Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 3b58822

Browse files
[211115] 완주하지 못한 선수
1 parent 571edbc commit 3b58822

File tree

1 file changed

+24
-0
lines changed

1 file changed

+24
-0
lines changed
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
import java.util.*;
2+
3+
class Solution {
4+
public String solution(String[] participant, String[] completion) {
5+
String answer = "";
6+
Map<String, Integer> map = new HashMap<>();
7+
8+
for(String str : participant){
9+
map.put(str, map.getOrDefault(str, 0)+1);
10+
}
11+
12+
for(String str : completion){
13+
map.put(str, map.get(str)-1);
14+
}
15+
16+
for(String key : map.keySet()){
17+
if(map.get(key) == 1){
18+
answer = key;
19+
}
20+
}
21+
22+
return answer;
23+
}
24+
}

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /