Skip to content

Commit 50025c9

Browse files
authored
Merge pull request #633 from Yujin-Baek/main
[백유진] 93차 라이브 코테 제출
2 parents 95bd29d + 71a7f0c commit 50025c9

2 files changed

Lines changed: 29 additions & 0 deletions

File tree

live9/test93/문제1/백유진.py

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
def solution(number, k):
2+
answer = ''
3+
4+
stack = []
5+
6+
for num in number:
7+
while k > 0 and stack and stack[-1] < num:
8+
stack.pop()
9+
k -= 1
10+
stack.append(num)
11+
12+
answer = ''.join(stack[:len(number)-k])
13+
return answer

live9/test93/문제2/백유진.py

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
def solution(name):
2+
answer = 0
3+
4+
min_cursor = len(name) - 1
5+
6+
for idx, alphabet in enumerate(name):
7+
answer += min(ord(alphabet) - 65, 91 - ord(alphabet))
8+
9+
end = idx+1
10+
while end < len(name) and name[end] == 'A':
11+
end += 1
12+
min_cursor = min(min_cursor, idx*2 + len(name)-end, (len(name)-end)*2 + idx)
13+
14+
answer += min_cursor
15+
16+
return answer

0 commit comments

Comments
 (0)