1
# Runtime: 53 ms (Top 33.00%) | Memory: 13.9 MB (Top 98.49%)13
return self.stack.pop()16
return len(self.stack)19
return len(self.stack) == 025
self.stack1 = MyStack()26
self.stack2 = MyStack()28
def push(self, x: int) -> None:32
while not self.stack1.isEmpty():33
self.stack2.push(self.stack1.pop())34
out = self.stack2.pop()35
while not self.stack2.isEmpty():36
self.stack1.push(self.stack2.pop())39
def peek(self) -> int:40
while not self.stack1.isEmpty():41
self.stack2.push(self.stack1.pop())42
out = self.stack2.top()43
while not self.stack2.isEmpty():44
self.stack1.push(self.stack2.pop())47
def empty(self) -> bool:48
return self.stack1.isEmpty()51
# Your MyQueue object will be instantiated and called as such:56
# param_4 = obj.empty()