You are viewing a single comment's thread. Return to all comments →
#python class Solution: def __init__(self): self.stack=[] self.queue=[] def pushCharacter(self, ch): self.stack.append(ch) def enqueueCharacter(self, ch): self.queue.append(ch) def popCharacter(self): top=self.stack[-1] self.stack.pop() return top def dequeueCharacter(self): first=self.queue[0] self.queue.pop(0) return first
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 →