def solution(number, k):
stack = []
for num in number:
while stack and stack[-1] < num and k > 0:
k -= 1
stack.pop()
stack.append(num)
if k != 0 :
stack = stack[:-k]
return ''.join(stack)
'프로그래머스 > [코테]Level2' 카테고리의 다른 글
[Python] 구명보트 (0) | 2020.11.06 |
---|---|
[Python] 문자열 압축 (0) | 2020.10.24 |
[Python] 주식가격 (0) | 2020.10.23 |
[Python] 위장 (0) | 2020.10.23 |
[Python] H-Index (0) | 2020.10.23 |