Skip to content

Commit 56fe606

Browse files
yoouyeonuyeon0
authored andcommitted
πŸ’‘ ν”„λ‘œκ·Έλž˜λ¨ΈμŠ€ 42888 - μ˜€ν”ˆμ±„νŒ…λ°©
1 parent 147ec97 commit 56fe606

File tree

1 file changed

+21
-0
lines changed

1 file changed

+21
-0
lines changed

β€ŽProgrammers/Level2/42888_μ˜€ν”ˆμ±„νŒ…λ°©.jsβ€Ž

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,27 @@
55
링크 : https://school.programmers.co.kr/learn/courses/30/lessons/42888
66
*/
77

8+
// ANCHOR - 2025.12.07 풀이
9+
function solution(record) {
10+
const userMap = new Map();
11+
for (let idx = 0; idx < record.length; idx++) {
12+
const [type, uid, name] = record[idx].split(" ");
13+
if (type === "Enter" || type === "Change") {
14+
userMap.set(uid, name);
15+
}
16+
}
17+
18+
const answer = [];
19+
for (let idx = 0; idx < record.length; idx++) {
20+
const [type, uid, _] = record[idx].split(" ");
21+
if (type === "Enter") answer.push(`${userMap.get(uid)}λ‹˜μ΄ λ“€μ–΄μ™”μŠ΅λ‹ˆλ‹€.`);
22+
else if (type === "Leave")
23+
answer.push(`${userMap.get(uid)}λ‹˜μ΄ λ‚˜κ°”μŠ΅λ‹ˆλ‹€.`);
24+
}
25+
26+
return answer;
27+
}
28+
829
// ANCHOR 2025.10.06 풀이
930
function solution2(record) {
1031
const nicknameMap = new Map(); // key: μœ μ € 아이디, value: ν˜„μž¬ λ‹‰λ„€μž„

0 commit comments

Comments
Β (0)