Skip to content

Commit 93bb314

Browse files
committed
[level 1] Title: 완주하지 못한 선수, Time: 38.17 ms, Memory: 102 MB -BaekjoonHub
1 parent 42d1608 commit 93bb314

2 files changed

Lines changed: 13 additions & 12 deletions

File tree

프로그래머스/1/42576. 완주하지 못한 선수/README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
# [level 1] 완주하지 못한 선수 - 42576
22

3-
[문제 링크](https://school.programmers.co.kr/learn/courses/30/lessons/42576?language=java)
3+
[문제 링크](https://school.programmers.co.kr/learn/courses/30/lessons/42576)
44

55
### 성능 요약
66

7-
메모리: 102 MB, 시간: 41.53 ms
7+
메모리: 102 MB, 시간: 38.17 ms
88

99
### 구분
1010

@@ -16,7 +16,7 @@
1616

1717
### 제출 일자
1818

19-
2026년 05월 07일 22:49:45
19+
2026년 05월 09일 00:53:37
2020

2121
### 문제 설명
2222

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,22 @@
1-
import java.util.HashMap;
1+
import java.util.*;
22

33
class Solution {
44
public String solution(String[] participant, String[] completion) {
5-
// 해시맵 생성 participant로
65
HashMap<String, Integer> map = new HashMap<>();
7-
for (String player: participant)
6+
7+
for (String player: participant){
88
map.put(player, map.getOrDefault(player, 0) + 1);
9+
}
910

10-
// 해시맵 수정 completion으로 - 1
11-
for (String player: completion)
11+
for (String player: completion){
1212
map.put(player, map.get(player) - 1);
13+
}
1314

14-
// 0이 아닌 keySet에서 찾기
15-
for (String key: map.keySet())
16-
if (map.get(key) != 0)
15+
for (String key: map.keySet()){
16+
if (map.get(key) == 1){
1717
return key;
18+
}
19+
}
1820
return "";
19-
2021
}
2122
}

0 commit comments

Comments
 (0)