Skip to content

Commit a9812f4

Browse files
committed
주식가격(42584) - Lv.2
1 parent e323f42 commit a9812f4

File tree

1 file changed

+18
-1
lines changed

1 file changed

+18
-1
lines changed

Algorithm/ProgrammersCodingTest/PythonCodingTest.py

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4012,4 +4012,21 @@ def dfs(d, office):
40124012

40134013
dfs(0, office)
40144014

4015-
print(min_blind_spot)
4015+
print(min_blind_spot)
4016+
4017+
4018+
4019+
# 주식가격(42584) - Lv.2
4020+
def solution(prices):
4021+
length = len(prices)
4022+
result = [i for i in range (length - 1, -1, -1)]
4023+
stack = [0]
4024+
4025+
for i in range (1, length, 1):
4026+
while stack and prices[stack[-1]] > prices[i]:
4027+
j = stack.pop()
4028+
result[j] = i - j
4029+
4030+
stack.append(i)
4031+
4032+
return result

0 commit comments

Comments
 (0)