Leetcode-Easy 155. Min Stack
原创
©著作权归作者所有:来自51CTO博客作者wx6464351503832的原创作品,请联系作者获取转载授权,否则将追究法律责任
234. Palindrome Linked List
class MinStack:
def __init__(self):
"""
initialize your data structure here.
"""
self.data=[]
def push(self, x):
"""
:type x: int
:rtype: void
"""
self.data.append(x)
def pop(self):
"""
:rtype: void
"""
self.data=self.data[:-1]
def top(self):
"""
:rtype: int
"""
return self.data[-1]
def getMin(self):
"""
:rtype: int
"""
return min(self.data)
# Your MinStack object will be instantiated and called as such:
# obj = MinStack()
# obj.push(x)
# obj.pop()
# param_3 = obj.top()
# param_4 = obj.getMin()