难度: Easy
原题连接
又到了作弊神预言Python的强项
class Stack(object):
def __init__(self):
"""
initialize your data structure here.
"""
self.lst = []
def push(self, x):
"""
:type x: int
:rtype: nothing
"""
self.lst.append(x)
def pop(self):
"""
:rtype: nothing
"""
self.lst.remove(self.lst[-1])
def top(self):
"""
:rtype: int
"""
return self.lst[-1]
def empty(self):
"""
:rtype: bool
"""
return self.lst == []