
* 겪고 있는 문제 상황을 최대한 자세하게 작성해주세요.
* 문제 해결을 위해 어떤 시도를 해보았는지 구체적으로 함께 알려주세요.
백준 스택 수열(실버2)에서 문제를 푸는데 질문이 있어서 글을 올립니다!
예시로 주어진 테스트 케이스는 모두 통과한 것 같은데 어디서 오류가 난지 모르겠습니다.
문제가 발생할 수 있는 다른 예시 케이스를 알려주실 수 있나요?
https://www.acmicpc.net/problem/1874
from collections import deque
T = int(input())
stack = []
inputQ = deque()
result = []
for i in range(T):
n = int(input())
inputQ.append(n)
for i in range(1, T+1):
stack.append(i)
result.append('+')
while(stack and inputQ and stack[-1] == inputQ[0]):
print('stack[-1]: ', stack[-1])
print('inputQ[0]: ', inputQ[0])
stack.pop()
result.append('-')
inputQ.popleft()
if stack:
print('No')
else:
for i in result:
print(i)
