[Programmers/Level 2] 탑
https://programmers.co.kr/learn/courses/30/lessons/42588 def solution(heights): answer = [0] * len(heights) for i in range(len(heights)-1, -1, -1): for j in range(i-1, -1, -1): if(heights[i]= max_val: stack.append(0) max_pos = i+1 max_val = heights[i] if heights[i] < max_val: stack.append(max_pos) if heights[i] < heights[i-1]: max_pos = i max_val = heights[i-1] stack.pop() stack.append(max_pos) ..
2020. 6. 17. 13:48