https://leetcode.cn/problems/intersection-of-two-linked-lists/
    需要注意的点
    1.链表a和b组合起来,如果有交点,

    1. # Definition for singly-linked list.
    2. # class ListNode:
    3. # def __init__(self, x):
    4. # self.val = x
    5. # self.next = None
    6. class Solution:
    7. def getIntersectionNode(self, headA: ListNode, headB: ListNode) -> ListNode:
    8. if not headA or not headB:
    9. return None
    10. pa = headA
    11. pb = headB
    12. while pa != pb:
    13. if pa:
    14. pa = pa.next
    15. else:
    16. pa = headB
    17. if pb:
    18. pb = pb.next
    19. else:
    20. pb = headA
    21. return pa