【hot100篇-python刷题记录】【相交链表】
R5-链表篇


K神逆天思路

# Definition for singly-linked list.
# class ListNode:
# def __init__(self, x):
# self.val = x
# self.next = Noneclass Solution:def getIntersectionNode(self, headA: ListNode, headB: ListNode) -> Optional[ListNode]:A,B=headA,headBwhile A!=B:A=A.next if A else headBB=B.next if B else headA return A

