top只是取值,不删除;pop取值之后会删除
用Python有点犯规
# -*- coding:utf-8 -*-
class Solution:
def __init__(self):
self.stack = []
def push(self, node):
# write code here
self.stack.append(node)
#return stack
def pop(self):
# write code here
return self.stack.pop()
def top(self):
# write code here
return self.stack[-1]
def min(self):
# write code here
return min(self.stack)