티스토리 뷰
문제출처 - https://programmers.co.kr/learn/courses/30/lessons/42888
프로그래머스
코드 중심의 개발자 채용. 스택 기반의 포지션 매칭. 프로그래머스의 개발자 맞춤형 프로필을 등록하고, 나와 기술 궁합이 잘 맞는 기업들을 매칭 받으세요.
programmers.co.kr
def solution(record):
answer = []
res = []
dic = {} # {id: 닉네임}
for i in range(len(record)):
temp = record[i].split(' ')
if temp[0] == 'Enter':
dic[temp[1]] = temp[2]
res.append([temp[0], temp[1]])
elif temp[0] == 'Leave':
res.append([temp[0], temp[1]])
else:
dic[temp[1]] = temp[2]
for i in range(len(res)):
if res[i][0] == 'Enter':
string = dic[res[i][1]] + "님이 들어왔습니다."
answer.append(string)
else:
string = dic[res[i][1]] + "님이 나갔습니다."
answer.append(string)
return answer
'ALGORITHM > 프로그래머스' 카테고리의 다른 글
[Python] 프로그래머스 - 짝지어 제거하기(LEVEL2) (0) | 2020.03.14 |
---|---|
[Python] 프로그래머스 - 땅따먹기(LEVEL2) (0) | 2020.03.14 |
[MYSQL]프로그래머스 - DATETIME에서 DATE로 형 변환(LEVEL2) (0) | 2020.03.12 |
[MYSQL]프로그래머스 - 오랜 기간 보호한 동물2(LEVEL3) (0) | 2020.03.12 |
[MYSQL]프로그래머스 - 중성화 여부 파악하기(LEVEL2) (0) | 2020.03.12 |
공지사항
최근에 올라온 글
최근에 달린 댓글
- Total
- Today
- Yesterday
링크
TAG
- 프로그래머스
- 딕셔너리
- 우선순위큐
- C++
- 괄호
- hash
- 파이썬
- 정렬
- 해시
- 문자열
- 완전탐색
- 2020 KAKAO BLIND RECRUITMENT
- combination
- Python
- 구현
- 힙
- BOJ
- dictionary
- Permutation
- 재귀
- 순열
- left join
- 백준
- SWExpert
- 문자열처리
- SW Expert
- 스택
- programmers
- 2019 Kakao Blind Recruitment
- 코딩테스트
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | 2 | 3 | 4 | 5 | ||
6 | 7 | 8 | 9 | 10 | 11 | 12 |
13 | 14 | 15 | 16 | 17 | 18 | 19 |
20 | 21 | 22 | 23 | 24 | 25 | 26 |
27 | 28 | 29 | 30 |
글 보관함