# -*- coding:utf-8 -*-
class Solution:
def __init__(self):
self.stack = []
def push(self, node):
# write code here
if not self.stack:
self.stack.append((node, node))
else:
# 将当前最小值 保存了起来
self.stack.append((node, min(node, self.stack[-1][1])))
def pop(self):
# write code here
self.stack.pop()
def top(self):
# write code here
return self.stack[-1][0]
def min(self):
# write code here
return self.stack[-1][1]

京公网安备 11010502036488号