https://school.programmers.co.kr/learn/courses/30/lessons/42888
프로그래머스
코드 중심의 개발자 채용. 스택 기반의 포지션 매칭. 프로그래머스의 개발자 맞춤형 프로필을 등록하고, 나와 기술 궁합이 잘 맞는 기업들을 매칭 받으세요.
programmers.co.kr
const Show = {
Enter: "님이 들어왔습니다.",
Leave: "님이 나갔습니다."
};
function solution(record) {
const nicknName = {};
const output = [];
record.forEach((e) => {
const [execution, id, name] = e.split(' ');
if (["Enter", "Change"].includes(execution)) nicknName[id] = name;
if (["Enter", "Leave"].includes(execution)) output.push([execution, id]);
});
return output.map(([execution, id]) => `${nicknName[id]}${Show[execution]}`);
}
GitHub - developeSHG/Algorithm-Baekjoon_Programmers: 백준 and 프로그래머스 소스코드
백준 and 프로그래머스 소스코드. Contribute to developeSHG/Algorithm-Baekjoon_Programmers development by creating an account on GitHub.
github.com
'Coding Test > Programmers' 카테고리의 다른 글
[Programmers] (stack) Lv 2. 뒤에 있는 큰 수 찾기 (0) | 2023.02.25 |
---|---|
[Programmers] Lv 2. 124 나라의 숫자 (0) | 2023.02.25 |
[Programmers] (Summer/Winter Coding(~2018)) Lv 2. 스킬트리 (0) | 2023.02.24 |
[Programmers] Lv 2. 2 x N 타일링 (0) | 2023.02.24 |
[Programmers] (스택/큐) Lv 2. 다리를 지나는 트럭 (0) | 2023.02.24 |
댓글