Merge pull request #6 from janeyziqinglin/janeyziqinglin-patch-6

Update 面试题02.07.链表相交 python版本
This commit is contained in:
JaneyLin 2022-06-16 10:08:04 -05:00 committed by GitHub
commit a62775e98c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 2 additions and 0 deletions

View File

@ -160,6 +160,8 @@ class Solution:
那么,只要其中一个链表走完了,就去走另一条链表的路。如果有交点,他们最终一定会在同一个
位置相遇
"""
if headA is None or headB is None:
return None
cur_a, cur_b = headA, headB # 用两个指针代替a和b