Skip to content

Commit 7159654

Browse files
authored
Merge pull request #635 from baekhangyeol/main
[백한결] 93차 라이브 코테 제출
2 parents 0f1a5f1 + 7a7fb45 commit 7159654

File tree

3 files changed

+46
-0
lines changed

3 files changed

+46
-0
lines changed

live9/test93/문제1/백한결.py

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

live9/test93/문제2/백한결.py

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
def solution(name):
2+
count = 0
3+
4+
for a in name:
5+
count += min(ord(a) - ord('A'), ord('Z') - ord(a) + 1)
6+
7+
min_move = len(name) - 1
8+
9+
for i in range(len(name)):
10+
next = i + 1
11+
while next < len(name) and name[next] == 'A':
12+
next += 1
13+
14+
move = min(i, len(name) - next) * 2 + max(i, len(name) - next)
15+
min_move = min(min_move, move)
16+
17+
count += min_move
18+
19+
return count
20+
21+
22+
print(solution("JEROEN"))

live9/test93/문제3/백한결.py

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
def solution(routes):
2+
routes.sort(key=lambda x: x[1])
3+
4+
count = 0
5+
camera = -30001
6+
7+
for i in range(len(routes)):
8+
if routes[i][0] > camera:
9+
count += 1
10+
camera = routes[i][1]
11+
12+
return count

0 commit comments

Comments
 (0)