You are viewing a single comment's thread. Return to all comments →
from queue import deque class Solution: def __init__(self): self.stack=[] self.queue=deque() def pushCharacter(self,data): self.stack.append(data) def enqueueCharacter(self,data): self.queue.append(data) def popCharacter(self): return self.stack.pop() def dequeueCharacter(self): return self.queue.popleft()
Seems like cookies are disabled on this browser, please enable them to open this website
Day 18: Queues and Stacks
You are viewing a single comment's thread. Return to all comments →