Notice
Recent Posts
Recent Comments
Link
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
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 |
Tags
- maeil-mail
- sw expert academy
- programmers
- redux-toolkit
- 자바
- axios
- 매일메일
- JavaScript
- 이코테
- react-router
- C++
- redux
- 알고리즘
- Algorithm
- 코딩테스트합격자되기
- createSlice
- useDispatch
- 리액트
- react-redux
- 항해플러스
- 항해99
- 프로그래머스
- SW
- 테코테코
- react
- java
- json-server
- redux-saga
- Python
- Get
Archives
- Today
- Total
Binary Journey
[프로그래머스] 압축 본문
반응형
출처: 프로그래머스 코딩 테스트 연습, https://programmers.co.kr/learn/challenges
level 2 너무 어렵다,,
def solution(msg):
dic = {}
for i in range(26):
dic[chr(65+i)] = i+1
w = 0
c = 0
answer = []
while True:
c += 1
if len(msg) == c:
answer.append(dic[msg[w:c]])
break
if msg[w:c+1] not in dic:
dic[msg[w:c+1]] = len(dic) + 1
answer.append(dic[msg[w:c]])
w = c
return answer
참고: https://hazung.tistory.com/89
반응형
'프로그래머스 > level 2' 카테고리의 다른 글
[프로그래머스] 방금그곡 (0) | 2022.01.04 |
---|---|
[프로그래머스] 파일명 정렬 (0) | 2021.12.28 |
[프로그래머스] 가장 큰 정사각형 찾기 (0) | 2021.12.27 |
[프로그래머스] 구명보트 (0) | 2021.12.20 |
[프로그래머스] n 진수 게임 (0) | 2021.12.14 |