class MyCircularQueue:
def __init__(self, k: int):
self.a = []
self.k = k
def enQueue(self, value: int) -> bool:
if len(self.a) == self.k:
return False
self.a.append(value)
return True
def deQueue(self) -> bool:
if len(self.a) == 0:
return False
self.a.pop(0)
return True
def Front(self) -> int:
if len(self.a) == 0:
return -1
return self.a[0]
def Rear(self) -> int:
if len(self.a) == 0:
return -1
return self.a[-1]
def isEmpty(self) -> bool:
if len(self.a) == 0:
return True
return False
def isFull(self) -> bool:
if len(self.a) == self.k:
return True
return False
# Your MyCircularQueue object will be instantiated and called as such:
# obj = MyCircularQueue(k)
# param_1 = obj.enQueue(value)
# param_2 = obj.deQueue()
# param_3 = obj.Front()
# param_4 = obj.Rear()
# param_5 = obj.isEmpty()
# param_6 = obj.isFull()
780C - Andryusha and Colored Balloons | 1153A - Serval and Bus |
1487C - Minimum Ties | 1136A - Nastya Is Reading a Book |
1353B - Two Arrays And Swaps | 1490E - Accidental Victory |
1335A - Candies and Two Sisters | 96B - Lucky Numbers (easy) |
1151B - Dima and a Bad XOR | 1435B - A New Technique |
1633A - Div 7 | 268A - Games |
1062B - Math | 1294C - Product of Three Numbers |
749A - Bachgold Problem | 1486B - Eastern Exhibition |
1363A - Odd Selection | 131B - Opposites Attract |
490C - Hacking Cypher | 158B - Taxi |
41C - Email address | 1373D - Maximum Sum on Even Positions |
1574C - Slay the Dragon | 621A - Wet Shark and Odd and Even |
1395A - Boboniu Likes to Color Balls | 1637C - Andrew and Stones |
1334B - Middle Class | 260C - Balls and Boxes |
1554A - Cherry | 11B - Jumping Jack |