Notice
Recent Posts
Recent Comments
Link
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | 2 | 3 | 4 | 5 | 6 | 7 |
8 | 9 | 10 | 11 | 12 | 13 | 14 |
15 | 16 | 17 | 18 | 19 | 20 | 21 |
22 | 23 | 24 | 25 | 26 | 27 | 28 |
29 | 30 |
Tags
- MongoDB
- AWS
- Express
- TypeScript
- typeorm
- macos
- OOAD
- Android
- css
- S3
- postman
- algorithm
- HTML
- wireshark
- Kotlin
- Network
- DATABASE
- mongoose
- sequelize
- Util
- python
- OS
- linux
- ubuntu
- Crawling
- mysql
- Scheduling
- React
- docker
- node.js
Archives
- Today
- Total
목록
반응형
Stack (1)
반응형
Seongwon Lim
[Python] 백준 2493 - 탑 (스택)
제약 사항 시간 제한 : 1.5 초 메모리 제한 : 128MB 문제 입력 출력 예제 입력 5 6 9 5 7 4 예제 출력 0 0 2 2 4 잘못된 접근 방식 import sys input = sys.stdin.readline n = int(input()) li = list(map(int, input().rstrip().split())) result = [] for i in range(len(li)-1, -1, -1): temp = li[i] st = [] if i == 0: # 맨 앞의 탑인 경우 result.append(0) else: for j in range(i-1, -1, -1): # 이전 탑들의 높이 탐색 if li[j] > temp and not st: st.append((li[j], j+1)..
Algorithm
2022. 10. 10. 14:45