원형덱(2)
-
[자료구조] Circle Deque (원형 덱) 구현
Circle Deque (원형 덱) class MyCircularDeque: def __init__(self, k: int): self.q = [None] * (k+1) self.max = k+1 self.front = 0 self.rear = 0 def insert_front(self, value: int): if self.is_full(): print('Deque is Full') else: self.q[self.front] = value self.front = (self.front - 1 + self.max) % self.max def insert_last(self, value: int): if self.is_full(): print('Deque is Full') else: self.rear = (..
2021.01.19 -
[Leetcode] 641. Design Circular Deque
Leetcode 641. Design Circular Deque https://leetcode.com/problems/design-circular-deque/ Design Circular Deque - 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 Solution class MyCircularDeque: def __init__(self, k: int): self.q = [None] * (k+1) self.max = k+1 self.front = 0 self.re..
2021.01.19