Skip to content

Commit ba31161

Browse files
Update 面试题02.07.链表相交.md
1 parent 87abfa1 commit ba31161

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

problems/面试题02.07.链表相交.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -160,6 +160,8 @@ class Solution:
160160
那么,只要其中一个链表走完了,就去走另一条链表的路。如果有交点,他们最终一定会在同一个
161161
位置相遇
162162
"""
163+
if headA is None or headB is None:
164+
return None
163165
cur_a, cur_b = headA, headB # 用两个指针代替a和b
164166

165167

0 commit comments

Comments
 (0)