Skip to content

Commit d97eac8

Browse files
committed
linked list done for now
1 parent 42b9756 commit d97eac8

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

data_structure/linked_list.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
链表相关的核心点
66

7-
- null/nil 异常处理
7+
- None的处理(访问node.next前,必须先check node is not None)
88
- dummy node 哑巴节点
99
- 快慢指针
1010
- 插入一个节点到排序链表
@@ -318,8 +318,9 @@ class Solution:
318318
slow = fast = head
319319

320320
while fast is not None and fast.next is not None:
321+
# 只要需要访问.next,都必须先check是否为空。这就是while fast的用途。
321322
slow = slow.next
322-
fast = fast.next.next
323+
fast = fast.next.next
323324
if fast == slow:
324325
return True
325326

0 commit comments

Comments
 (0)