Skip to content

Commit 452b5b1

Browse files
committed
105차 3번 문제 풀이
1 parent 6b1d229 commit 452b5b1

1 file changed

Lines changed: 14 additions & 0 deletions

File tree

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
def solution(order):
2+
i = 0
3+
stack = []
4+
5+
for box in range(1, len(order) + 1):
6+
if box == order[i]:
7+
i += 1
8+
else:
9+
stack.append(box)
10+
while stack and stack[-1] == order[i]:
11+
stack.pop()
12+
i += 1
13+
14+
return i

0 commit comments

Comments
 (0)