mirror of
https://github.com/krahets/hello-algo.git
synced 2025-07-10 17:00:45 +08:00
Several enhancements and fixes
This commit is contained in:
@ -62,9 +62,8 @@ class LinkedListDeque:
|
||||
|
||||
def pop(self, is_front: bool) -> int:
|
||||
"""出队操作"""
|
||||
# 若队列为空,直接返回 None
|
||||
if self.is_empty():
|
||||
return None
|
||||
raise IndexError("双向队列为空")
|
||||
# 队首出队操作
|
||||
if is_front:
|
||||
val: int = self.front.val # 暂存头节点值
|
||||
|
Reference in New Issue
Block a user