1 # -*- coding:utf-8 -*- 2 class Solution: 3 def __init__(self): 4 self.stack = [] 5 self.list = [] 6 7 def push(self, node): 8 self.stack.append(node) 9 self.list.append(node) 10 self.list = sorted(self.list) 11 # write code here 12 def pop(self): 13 r = self.stack.pop(-1) 14 self.list.remove(r) 15 return r 16 # write code here 17 def top(self): 18 r = self.stack[-1] 19 return r 20 # write code here 21 def min(self): 22 r = self.list[0] 23 return r 24 # write code here
原文:https://www.cnblogs.com/asenyang/p/11013875.html