minimal-mistakes
minimal-mistakes copied to clipboard
Update _config.yml
오늘 배운것을 모두 써보기
- 먼저 리스트를 만들어본다
- 이렇게 쉽게 해결
링크도 활용하기
Click here
마지막으로 테이블 작성하기
1번 항목 | 2번항목 |
---|---|
cell1 | cell2 |
ccell3 | cell4 |
코팅 넣어보기
import sys
from collections import Counter
input=sys.stdin.readline
N=int(input())
word=list(map(int,input().split()))
answer=[-1]*N
stk=[]
counter=Counter(word)
for i in range(N):
while stk and counter[word[stk[-1]]]<counter[word[i]]:
answer[stk.pop()]=word[i]
stk.append(i)
print(*answer)