You are viewing a single comment's thread. Return to all comments →
Python3
import queue class Solution: def __init__(self): self.queue = queue.Queue() self.stack = queue.LifoQueue() def pushCharacter(self,ch): self.stack.put(ch) def enqueueCharacter(self,ch): self.queue.put(ch) def popCharacter(self): return self.stack.get() def dequeueCharacter(self): return self.queue.get()
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 →
Python3