일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
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
- Queue
- Level2
- lv4
- sql
- 프로그래머스
- cte
- BFS
- collections
- import re
- 조합
- 코딩테스트
- mysql
- 코테
- 시간복잡도
- time complexity
- Stack
- 파이썬
- itertools
- coding test
- level4
- 완전탐색
- 코딩
- counter
- coding
- python
- 데이터분석
- lambda
- 연습문제
- join
- programmers
- Today
- Total
목록appendleft (1)
ror_coding
[Python] Stack, Queue (collections) (deque)
from collections import dequeStack (스택)Queue (큐) from collections import dequeq = deque([1,2,3], maxlen = 5) # 크기 고정.# 추가.q.append(4) # [1,2,3,4]q.appendleft(0) # [0,1,2,3,4]# 제거 ( = 쓰면 제거된 값을 반환)q.pop() # [0,1,2,3]q.popleft() # [1,2,3]# 확장q.extend([4,5]) # [1,2,3] => [1,2,3,4,5]q.extendleft([4,5]) # [1,2,3] => [5,4,1,2,3]# 회전q.rotate(1) # [1,2,3] => [3,1,2]
Algorithm/Python
2024. 12. 2. 16:04