标签:pre sub pytho 用两个 odi ack while pen not
# -*- coding:utf-8 -*- class Solution: def __init__(self): self.stack1 = [] self.stack2 = [] def push(self, node): # write code here self.stack1.append(node) return self.stack1 def pop(self): # return xx if self.stack2: return self.stack2.pop() elif not self.stack1: return else: while self.stack1: self.stack2.append(self.stack1.pop()) return self.stack2.pop()
标签:pre sub pytho 用两个 odi ack while pen not
原文地址:https://www.cnblogs.com/ansang/p/11993862.html