일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
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
- realclass
- 읽기
- Writing
- FIT XR
- 10분
- 잡생각
- 쓰릴오브파이트
- 영어공부
- 링피트
- English
- 괜찮음
- 리얼 클래스
- 운동
- 사이드
- leetcode
- 매일
- Daily Challenge
- 화상영어
- 스탭퍼
- 30분
- 뭐든
- 프로젝트
- 영어원서읽기
- Problem Solving
- 월간
- 3줄정리
- 만화도
- 개발자
- 미드시청
- 파비최
Archives
- Today
- Total
파비의 매일매일 공부기록
Today's Challenge 본문
https://leetcode.com/problems/implement-queue-using-stacks/
Implement Queue using Stacks - LeetCode
Level up your coding skills and quickly land a job. This is the best place to expand your knowledge and get prepared for your next interview.
leetcode.com
list로 queue 구현 하면 되는 문제.
고민할 게 거의 없었음.
class MyQueue:
def __init__(self):
self.qu = []
def push(self, x: int) -> None:
self.qu.append(x)
def pop(self) -> int:
return self.qu.pop(0)
def peek(self) -> int:
return self.qu[0]
def empty(self) -> bool:
return len(self.qu) == 0
반응형
'Problem Solving > LeetCode' 카테고리의 다른 글
Today's Challenge (0) | 2022.12.18 |
---|---|
Today's Challenge (0) | 2022.12.17 |
Today's Challenge (0) | 2022.12.15 |
Today's Challenge (0) | 2022.12.14 |
Today's Challenge (0) | 2022.12.13 |
Comments