We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent ca46acf commit 789c357Copy full SHA for 789c357
프로그래머스/2/17684. [3차] 압축/README.md
@@ -4,7 +4,7 @@
4
5
### 성능 요약
6
7
-메모리: 9.98 MB, 시간: 0.80 ms
+메모리: 9.31 MB, 시간: 0.46 ms
8
9
### 구분
10
@@ -16,7 +16,7 @@
16
17
### 제출 일자
18
19
-2025년 01월 09일 11:38:35
+2025년 12월 28일 16:32:55
20
21
### 문제 설명
22
프로그래머스/2/17684. [3차] 압축/[3차] 압축.py
@@ -1,16 +1,16 @@
1
def solution(msg):
2
- answer = []
3
- dic = {chr(i + 64): i for i in range(1, 27)}
-
+ ans = []
+ dic = {chr(65+i):i+1 for i in range(26)}
+
w = c = 0
while True:
- c += 1
- if c == len(msg):
- answer.append((dic[msg[w:c]]))
+ c += 1
+ if c == len(msg):
+ ans.append(dic[msg[w:c]])
break
11
12
if msg[w:c+1] not in dic:
13
dic[msg[w:c+1]] = len(dic) + 1
14
- answer.append(dic[msg[w:c]])
15
w = c
- return answer
+ return ans
0 commit comments