# -*- coding:utf-8 -*- class Solution: def __init__(self): self.stack1=list() self.stack2=list() def push(self, node): # write code here self.stack1.append(node) def pop(self): # return xx if not self.stack2: for i in range(len(self.stack1)): self.stack2.append(self.stack1.pop(-1)) return self.stack2.pop(-1)
原文:https://www.cnblogs.com/foolangirl/p/13894146.html