algorithm/python
프로그래머스/스택,큐/탑
아르르르를를르
2020. 3. 7. 16:04
https://programmers.co.kr/learn/courses/30/lessons/42588
level2
스택, 큐 문제인데 좀 야매로 풀었다는 느낌이 든다.
def solution(heights):
answer = []
while(heights):
h = heights.pop()
for i in range(1, len(heights)+1):
if heights[-i] > h:
answer.append(len(heights)+1-i)
break
else:
answer.append(0)
answer.reverse()
return answer