This commit is contained in:
krahets
2024-04-16 04:01:59 +08:00
parent 1bc9502c19
commit cdd8923e98
23 changed files with 1113 additions and 107 deletions

View File

@ -365,7 +365,7 @@ Below is an example code for implementing a stack based on a linked list:
def is_empty(self) -> bool:
"""判断栈是否为空"""
return not self._peek
return self._size == 0
def push(self, val: int):
"""入栈"""
@ -1237,7 +1237,7 @@ Since the elements to be pushed onto the stack may continuously increase, we can
def is_empty(self) -> bool:
"""判断栈是否为空"""
return self._stack == []
return self._size == 0
def push(self, item: int):
"""入栈"""